putting checkbuttons in a listbox

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Wed Dec 21 11:16:39 CET 2005

valen1260 wrote:
> I'd like to have a multicolumn listbox, with one column being a list of 
> items and the other being a list of checkbuttons.  The user could check 
> his "favorites" and then shorten the list to show only the checked items.
> I have implemented the MultiListbox at 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266 .  I then 
> tried attaching the checkbuttons to a listbox object.  To get them to 
> display, I had to pack them, but in packing them, they just disregard 
> the scrollable listbox and take as much room as needed.
> Has anyone implemented anything like this?  Is there a way to put 
> checkbuttons in a fixed-height, scrollable listbox or similar structure?

snipped from the above recipe :-


The resulting widget is lightweight, fast, and very easy to use. The main
limitation is that only text is supported which is a fundamental limitation
of the Listbox.

In this implementation, only single-selection is allowed but it could be
extended to multiple selection. User-resizeable columns and auto-sorting by
clicking on the column label should also be possible.

Auto-scrolling while dragging Button-1 was disabled because this was breaks
the synchronization between the lists. However, scrolling with Button-2 

so you cannot put anything other than text into a standard Tk Listbox
however you could try using a non-standard table widget see here for 
more details :-



More information about the Python-list mailing list