thanks guys, I didn't realize that setting textvariable = varname explicitly delegates the value to this variable. In MATLAB things work differently.
cheers, Alex 2010/10/28 Lion Kimbro <lionkim...@gmail.com> > > 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() > 0 > >>> # now I set it to 10 in the user interface... > ... > >>> intvar.get() > 10 > >>> > > 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.1...@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@python.org >> http://mail.python.org/mailman/listinfo/tkinter-discuss >> >> >
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss