Tkinter scrollbar and checkbox
Mike Driscoll
kyosohma at gmail.com
Thu Apr 24 10:23:25 EDT 2008
On Apr 24, 7:11 am, goldtech <goldt... at worldpost.com> wrote:
> 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
I use wxPython most of the time, however effbot has a good tutorial on
scrollbars for Tkinter that I think you might find helpful:
http://effbot.org/zone/tkinter-scrollbar-patterns.htm
Here's another link on the subject:
http://www.pythonware.com/library/tkinter/introduction/scrollbar.htm
HTH
Mike
More information about the Python-list
mailing list