[Tkinter-discuss] (no subject)
lionkimbro at gmail.com
Wed Oct 27 21:13:03 CEST 2010
Alex, does this answer what you're trying to do?
>>> import tkinter
>>> top = tkinter.Tk()
>>> intvar = tkinter.IntVar()
>>> entry = tkinter.Entry(top, width=10, textvariable=intvar)
>>> # now I set it to 10 in the user interface...
I found the names of the variables pretty confusing;
When I used "intvar" and "entry", it was much clearer to me.
You wrote "#need to get the textvariable value from Entry popsize, not
...but I thought you were trying to get the widget's property?
When you set the value with "textvariable=intvar", the widget is now
explicitly delegating the value to intvar.
That is, the IntVar becomes the authority for the information.
On Wed, Oct 27, 2010 at 4:39 AM, Alex Ter-Sarkissov
<sigma.z.1980 at gmail.com>wrote:
> hi, here's my problem:
> let's say I have a function that uses some widget's property. How canI
> retireve the value of this property?
> For example,
> def rand_opo_gen (self,event):
> popsize_start=#need to get the textvariable value from Entry
> popsize, not variable PopSize!
> Another option, of course, is that the variable PopSize acquires the
> value from Entry, but I can't see how to do it either
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tkinter-discuss