Tkinter: Scrollable buttons
Robert Roy
rjroy at takingcontrol.com
Wed Oct 6 19:00:51 EDT 1999
You might want to try using Pmw . It has a scrolled frame class that
would be good for what you want to do.
http://www.dscpl.com.au/pmw/
On Wed, 06 Oct 1999 01:06:13 GMT, sragsdale at my-deja.com wrote:
>I've got a big panel full of buttons and such, and I need to add a
>scroll bar so that I can move up and down the list. The following code
>will construct something that _looks_ good, but the scrollbar won't
>actually do anything. Any idea what's wrong?
>
>#######################################################
>#!/usr/local/bin/python
>
>from Tkinter import *
>
>class App(Frame):
> def __init__(self,parent):
> Frame.__init__(self,parent)
> self.pack(expand=YES,fill=BOTH)
>
> items = Canvas(self)
> items.pack(anchor=N, expand=YES, fill=BOTH)
>
> scroll = Scrollbar(items)
> scroll.config(command=items.yview, relief=SUNKEN)
> scroll.pack(side=RIGHT, fill=Y)
>
> items.config(yscrollcommand=scroll.set, relief=SUNKEN)
>
> for i in range(1,100):
> b = Button(items,text=str(i))
> b.pack()
>
>myapp = App(None)
>myapp.mainloop()
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
More information about the Python-list
mailing list