update of elements in GUI

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


In article 
<24dc97b3-a8b5-4638-9cf5-a397f1eae295 at q16g2000prf.googlegroups.com>,
 Jah_Alarm <jah.alarm 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