[Tkinter-discuss] (no subject)

Lion Kimbro 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)
>>> entry.grid()
>>> intvar.get()
>>> # now I set it to 10 in the user interface...
>>> intvar.get()

  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
variable PopSize!"

  ...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,
> PopSize=IntVar();
> popsize=Entry(root,width=10,textvariable=PopSize)
> def rand_opo_gen (self,event):
>       popsize_start=#need to get the textvariable value from Entry
> popsize, not variable PopSize!
>       pop1=random.random(popsize_start*2)
> Another option, of course, is that the variable PopSize acquires the
> value from Entry, but I can't see how to do it either
> cheers,
> alex
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101027/c82e294f/attachment.html>

More information about the Tkinter-discuss mailing list