Tkinter scrollbar and checkbox

goldtech goldtech at worldpost.com
Thu Apr 24 14:11:44 CEST 2008


Hi,

I'm stumped on how to have a scrollbar with a long list of checkboxes.
Given code like:

from Tkinter import *
root = Tk()
states = []
for i in range(150):
    var = IntVar()
    chk = Checkbutton(root, text=str(i), variable=var)
    chk.grid(sticky=W)
    states.append(var)
root.mainloop()
print map((lambda var: var.get()), states)

I've tried adding this to a frame then adding the frame to a canvas
and it gets complicated rather quickly...

Is there a simple way to add a scroll bar?

Thanks



More information about the Python-list mailing list