Bwidgets are a set of widgets written in Tcl, like the Tkinter widgets. There is a Python wrapper for them called pybwidgets, available at One of the challenges of using BWidgets is that due to the scanty documentation, you may find that you need to be able to read the Tcl source code of the widget in order to be able to use it effectively.

Note that the Python wrapper for Bwidgets, i.e. the file that gets installed in /lib/site-packages/bwidget, requires Python version >= 2.0, because the following construct was not available in Python 1.5: r = f(self, *args, **kw)

Some of the widgets provided include:

It's useful to note that BWidgets can be used at the same time as other Tkinter widgets, or Pmw widgets, as the following example shows:

   1 from Tkinter import *
   2 from bwidget import *
   3 from Pmw import MenuBar
   4 t = Tk()
   6 def printMe(s):
   7         print s
   9 m = MenuBar(t, hull_relief = 'raised',
  10                 hull_borderwidth = 1)
  11 m.pack(fill = 'x')
  12 m.addmenu('File', 'Close this window or exit')
  13 m.addmenuitem('File', 'command', 'Close this window',
  14                 command = lambda s='Action: close': printMe(s),
  15                 label = 'Close')
  16 m.addmenuitem('File', 'separator')
  17 m.addmenuitem('File', 'command', 'Exit the application',
  18                 command = lambda s='Action: exit': printMe(s),
  19                 label = 'Exit')
  20 b = Button(t, relief=LINK, text="bwidget button", command=t.destroy)
  21 b.pack()
  22 t.mainloop()



tkinter: BWidgets (last edited 2010-07-26 11:59:12 by localhost)