[wxPython-users] Re: Snapping windows

Christopher Barker Chris.Barker at noaa.gov
Thu Mar 29 11:53:08 PDT 2007


Eli Golovinsky wrote:
> Your implementation jitters quite badly when you drag the window near 
> the left edge of the screen.

This is the result of Windows now asking the app to re-draw constantly 
as you move (and re-size) windows, so there is not "done moving" event. 
You may be able to turn that off (I know you can in most linux Window 
managers). But if you can't control your user's settings, that's not good.

One solution is to use a timer -- when you get a move event, start a 
timer for, say 1/10 sec (play with it to see what works). When the timer 
goes off, re-set the Frame position. Whenever you get a new move event, 
restart the timer. This should let the user move the window around near 
the edge, and then it will snap to position after they stop moving it.

This is done for Size events in wx.lib.FloatCanvas, if you want an 
example, but it's not hard to implement from scratch.

-CHB


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list