Here's one case where it's bad to call update.

        def perform_longrunning_calculation():
                time.sleep(1)
                app.update()
                time.sleep(1)

suppose you kick this off with a keybinding, such as:
        app.bind("c", lambda e: perform_longrunning_calculation())
the calculation takes 2 seconds, and after 1 second update() is called,
possibly to make sure that the user interface is repainted.

But imagine that in the first second, "c" has been pressed.  That event will
be handled, and perform_longrunning_calculation will be entered *again*,
recursively.  The nesting looks something like this:
  app's mainloop
    handling keypress
      perform_longrunning_calculation()
        app.update()
          handling keypress
            perform_longrunning_calculation()
by calling update_idletasks instead of update, the keypress event is not
handled, so it's impossible to enter perform_longrunning_calculation a
second time.

Jeff

Attachment: pgpF8UhzLmmsd.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to