passing data to Tkinter call backs

rantingrick rantingrick at gmail.com
Wed Jun 9 12:17:35 EDT 2010


On Jun 9, 4:23 am, Nick Keighley <nick_keighley_nos... at hotmail.com>
wrote:

> What mouse_clik_event does is modify some data and trigger a redraw.
> Is there any way to pass data to the callback function? Some GUIs give
> you a user-data field in the event, does Tkinter?

I don't know "how" you're triggering redraws but you need to read this
first...

w.update()
This method forces the updating of the display. It should be used only
if you know what you're doing, since it can lead to unpredictable
behavior or looping. It should never be called from an event callback
or a function that is called from an event callback.

w.update_idletasks()
Some tasks in updating the display, such as resizing and redrawing
widgets, are called idle tasks because they are usually deferred until
the application has finished handling events and has gone back to the
main loop to wait for new events.

If you want to force the display to be updated before the application
next idles, call the w.update_idletasks() method on any widget.



More information about the Python-list mailing list