thanks guys, I didn't realize that setting textvariable = varname explicitly delegates the value to this variable. In MATLAB things work differently. <br><br>cheers,<br><br>Alex <br><br><div class="gmail_quote">2010/10/28 Lion Kimbro <span dir="ltr"><<a href="mailto:lionkimbro@gmail.com">lionkimbro@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br> Alex, does this answer what you're trying to do?<br><br>>>> import tkinter<br>
>>> top = tkinter.Tk()<br>>>> intvar = tkinter.IntVar()<br>>>> entry = tkinter.Entry(top, width=10, textvariable=intvar)<br>
>>> entry.grid()<br>>>> intvar.get()<br>0<br>>>> # now I set it to 10 in the user interface...<br>...<br>>>> intvar.get()<br>10<br>>>><br><br> I found the names of the variables pretty confusing;<br>
When I used "intvar" and "entry", it was much clearer to me.<br><br> You wrote "<font face="Courier, Monospaced">#need to get the textvariable value from Entry popsize, not variable PopSize!</font>"<br>
<br> ...but I thought you were trying to get the widget's property?<br><br> When you set the value with "textvariable=intvar", the widget is now explicitly delegating the value to intvar.<br> That is, the IntVar becomes the authority for the information.<div>
<div></div><div class="h5"><br>
<br><br><div class="gmail_quote">On Wed, Oct 27, 2010 at 4:39 AM, Alex Ter-Sarkissov <span dir="ltr"><<a href="mailto:sigma.z.1980@gmail.com" target="_blank">sigma.z.1980@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font face="Courier, Monospaced">hi, here's my problem: <br> </font><p><font face="Courier, Monospaced">let's say I have a function that uses some widget's property. How canI <br>
retireve the value of this property? <br> </font></p><p><font face="Courier, Monospaced">For example, <br> </font></p><p><font face="Courier, Monospaced">PopSize=IntVar(); <br> </font></p>
<p><font face="Courier, Monospaced">popsize=Entry(root,width=10,textvariable=PopSize) <br> </font></p><p><font face="Courier, Monospaced">def rand_opo_gen (self,event): <br> popsize_start=#need to get the textvariable value from Entry <br>
popsize, not variable PopSize! <br> pop1=random.random(popsize_start*2) <br> </font></p><p><font face="Courier, Monospaced">Another option, of course, is that the variable PopSize acquires the <br>
value from Entry, but I can't see how to do it either <br> </font></p><p><font face="Courier, Monospaced">cheers, <br> </font></p><font face="Courier, Monospaced">alex </font>
<br>_______________________________________________<br>
Tkinter-discuss mailing list<br>
<a href="mailto:Tkinter-discuss@python.org" target="_blank">Tkinter-discuss@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tkinter-discuss" target="_blank">http://mail.python.org/mailman/listinfo/tkinter-discuss</a><br>
<br></blockquote></div><br>
</div></div></blockquote></div><br>