Too many Configure events
bob at greschke.com
Tue Jan 8 18:20:52 CET 2002
matt at mondoinfo.com (Matthew Dixon Cowles) wrote in message news:<zpuZ7.6880$aH2.3345948 at ruti.visi.com>...
> On Fri, 4 Jan 2002 16:14:47 -0700, Bob Greschke <bob at passcal.nmt.edu>
> >I have a Tkinter program that draws a graph. If the user grabs a
> >corner of the frame and resizes it I use the Configure event to clear
> >and redraw the graph. In (UNIX/Solaris) OpenWindows, and FVWM, one
> >Configure event gets generated when the user releases the mouse
> >button. But Gnome generates Configure events while the user is
> >resizing the frame. How can I detect (within the Configure handler
> >would be nice) that the user still has the mouse button pressed and
> >to ignore the Configure event? Detecting things like
> >ButtonPress/ButtonRelease and setting a flag doesn't seem to do it
> >(those events don't show up).
> Dear Bob,
> I'm not too surprised that your app don't see the click events. Since
> the clicks are in the window's border, those events are going to the
> window manager, not your app. It might work to use after() to set a
> timer of a few hundred milliseconds and only do the redraw when the
> timer is done. You could either reset the timer after each configure
> event and so only do the redraw when the window's size hadn't changed
> for some time or you could not set the timer if it was already set and
> so only do the redraw every once in a while rather than constantly.
I figured it was something like that.
I tried using an .after scheme, but then the .after interruped the
flow of Configure events, so I still had the same problem of multiple
Configures, but just in slow motion. It's like some of the Configures
get queued up during the .after timeout period (but not the same
quantity that I was getting without and .after timeout), and then they
get processed after the window resizing is finished. If you resize
the window quickly everything is fine. But if you resized it slowly,
or pause while you are dragging, then it trys to redraw (which makes
sense -- the timer times out), but then it sometimes redraws twice
after you have finished resizing. If I could only detect mouseDown
and mouseUp events from the window manager itself I'd be fine.
I can't really do anything with looking at window size either. If I
only get one Configure event the program will say, "Yep. The window
size has changed. Don't redraw yet." But that's the only time it
will ever check.
This all has to do with the window manager setting that determines if
the contents of the window should be shown during resizing or not
(opaque/box option in Gnome/Sawtooth). If it is set to not show the
contents then there is only one Configure event at the end and
everything is fine.
More information about the Python-list