Textvariable display in label (GUI design)

Eric Brunel eric.brunel at pragmadev.nospam.com
Tue Aug 17 03:21:59 EDT 2010


In article 
<ded2beea-2bf9-423d-9457-6b6beb7f7e63 at n19g2000prf.googlegroups.com>,
 Jah_Alarm <jah.alarm at gmail.com> wrote:

> On Aug 17, 3:32 am, Eric Brunel <eric.bru... at pragmadev.nospam.com>
> wrote:
> > In article
> > <993d9560-564d-47f0-b2db-6f0c6404a... at g6g2000pro.googlegroups.com>,
> >
> >  Jah_Alarm <jah.al... at gmail.com> wrote:
> > > hi,
> >
> > > pls help me out with the following issue: I wrote a function that uses
> > > a for loop that changes a value of a certain variable each iteration.
> > > What I want is by clicking a button in GUI (with the command bound to
> > > this function) this value each iteration is displayed in a textbox
> > > (label). So far only one (starting value) is displayed.
> >
> > > thanks,
> >
> > > Alex
> >
> > First, with posts like this, you're highly unlikely to get any useful
> > answer: please strip down your code to the smallest part that displays
> > the problem, post this code here, explaining what you're expecting and
> > what you're getting. Otherwise, people just won't know what you're
> > talking about unless they have a crystal ballÅ 
> >
> > Now using my own crystal ball: if you don't return the control to the
> > GUI each time your variable is increased, the GUI won't get a chance to
> > update itself. Since you seem to use Tkinter (another wild guessÅ ), you
> > probably need a call to the update_idletasks method on any Tkinter
> > widget each time you change your TextVariable.
> >
> > HTH
> >  - Eric -
> 
> Thanks, but where is this command used, in the button than runs the
> algorithm, the label or the function itself?

Wherever you want, the only requirement being that you should have a 
widget at hand, in a class attribute or a global variable or whatever. I 
would put it just after I do any my_variable.set(…) if possible.



More information about the Python-list mailing list