[Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

Alan Gauld alan.gauld at btinternet.com
Wed Mar 4 20:32:57 CET 2009


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

> I'm not sure what normal is. Do you have an example,

> Is this what you have in mind 
> <http://effbot.org/tkinterbook/entry.htm>?
> =================start
> from Tkinter import *
> master = Tk()
> e = Entry(master)
> e.pack()
> e.focus_set()
>
> def callback():
>    print e.get()
>
> b = Button(master, text="get", width=10, command=callback)
> b.pack()
>
> mainloop()
> ========================end

Yes thats exactly what I had in mind.

> This begs the question as to why one would use control variables at 
> all?
> From a light reading of the subject, it seems as though they may 
> help
> in certain circumstances of coupling.

Yes, although you can still do it by hand.

> One special quality of a control variable is that it can be shared 
> by a
> number of different widgets, and the control variable can remember
> all the widgets that are currently sharing it.

This is fairly rare in my experience but it would be handy. But OTOH
its sufficiently complex that I might prefer to make that complexity
explicit so that I remember its there!

HTH,

Alan G. 




More information about the Tutor mailing list