update of elements in GUI

Jah_Alarm jah.alarm at gmail.com
Tue Aug 17 05:49:46 EDT 2010


thanks. The thing is, the objects actually get updated without this
command, but when I run the GUI outside of python shell (i.e. in
command prompt as python filename.py or compile it to .exe file) the
objects do not get updated. I tried
Label(mainframe,textvariable=var).grid(column=1,row=1).update_idletasks()
and mainframe.update_idletasks() but it still doesn't work.


On Aug 17, 7:19 pm, Eric Brunel <eric.bru... at pragmadev.nospam.com>
wrote:
> In article
> <24dc97b3-a8b5-4638-9cf5-a397f1eae... at q16g2000prf.googlegroups.com>,
>
>  Jah_Alarm <jah.al... at gmail.com> wrote:
> > hi, I've already asked this question but so far the progress has been
> > small.
>
> > I'm running Tkinter. I have some elements on the screen (Labels, most
> > importantly) which content has to be updated every iteration of the
> > algorithm run, e.g. "Iteration =" [i] for i in range(n), n=100. I'm
> > using the update_idletasks() command in the function itself after the
> > variable.set(...) command. The variable type is IntVar(), and the
> > mistake I'm getting is 'IntVar instance has no attribute
> > 'update_idletasks'. No updates are displayed, of course.
>
> You have to call update_idletasks on a Tkinter *widget*, not a variable.
> You can call it on your window (Tk or Toplevel instance) or on your
> label for example. This way, it should work.
>
>
>
> > Without the GUI the algorithm (it's a genetic algorithm) is working
> > fine, but I need to make it available to other people via GUI
>
> > cheers,
>
> > Alex




More information about the Python-list mailing list