[Tutor] Tkinter: binding functions to widgets

Alan Colburn aicolburn@yahoo.com
Wed, 28 Aug 2002 15:20:11 -0700


I'm trying to learn some basic GUI design and, based on dicussions I've seen
on this list, started learning to use Tkinter. I'm doing fine in terms of
basic widget layout, parent & child frames, etc. The difficulty I'm having
lies in trying to get the GUI to do something other than look impressive :-)

I understand how one can use an Entry box, etc. to get information, but I
don't understand how to do things like store the information in a variable,
manipulate the information, or use the (manipulated) information to affect
what's displayed in the GUI. To make it concrete, I tried to come up with
something really simple I could ask you to write for me--something that' s
only a few lines of code.

Here's what I came up with. How would you write a GUI-based program in
which:
--a user enters a number
--the program outputs whether or not the number was, say, greater than 0
--(optional) How do you store this entered number in a way that it would be
available for other functions in the program, i.e, make it a global
variable?

I don't care what the program looks like ... it's the function binding I'm
struggling with :-)

Thanks, as always -- Al

p.s. The new semester starts soon; I'll stop asking questions at that point
:-)