Are there Tkinter examples somewhere?

Richard Chamberlain richard_chamberlainREMOVE at ntlworld.com
Wed Jan 17 02:44:31 EST 2001


Hi Terry,

from Tkinter import *
root=Tk()
def iMove(pos):
    print pos
myScale=Scale(root,orient=VERTICAL,length=200,from_=0,to=250,tickinterval=25
,command=iMove)
myScale.pack()
root.mainloop()

If you just pass the command option a function name it will pass a single
value which is the current value of the Scale.

If you going to be doing some serious work with Tkinter then have a look at
John Grayson's book Python and Tkinter programming.

Richard


Terry Hancock <hancock at earthlink.net> wrote in message
news:mailman.979701138.11862.python-list at python.org...
> Hi,
> I'm trying to learn how to use the Tkinter toolkit
> to build an applications in Python, and I'm
> having trouble fathoming how to use all the widgets.
>
> I've got a copy of Fredrik Lundh's "An Introduction
> to Tkinter", but I need a bit more on some widgets.
>
> For example, the "Scale" widget is very poorly
> represented.
>
> Specifically, I want to know how to get information
> out of the Scale object.  There's a "get" method
> to poll it, but I want to have it trigger a
> response when it changes in a conventional object-
> oriented way.  So, I guess I need to understand
> the "command" option callbacks better and how to
> use one with it.
>
> But this is just one of many little problems I
> have. Is there somewhere I can find sample
> code and stuff to get me started?  As is, I'm just
> guessing what options do based on the name, which
> is very frustrating (at least the document does
> list what the options are!)
>
> Thanks!
>
> --
> Terry Hancock
> hancock at earthlink.net
>





More information about the Python-list mailing list