Tkinter (and IDLE) window "docking?" effect when dragging root window to edge of display

Jerry Hill malaclypse2 at gmail.com
Wed Oct 20 13:44:12 EDT 2010


On Wed, Oct 20, 2010 at 11:32 AM,  <python at bdurham.com> wrote:
> Python 2.6/2.7 (32-bit) for Windows: When I drag a Tkinter root window to
> the left, upper, or right edge of my display ... as soon as my mouse cursor
> hits the visible edge of the display ... as if I'm trying to dock the window
> on the edge in question ... a giant phantom Tkinter window pops up
> underneath my window showing the size and placement of my root window if I
> would release my mouse button.
>
> You can see the identical behavior if you drag a non-maxmized IDLE window to
> one of your screen edges (left, top, bottom). This behavior seems to be "by
> design".
>
> I'm looking for a way to either disable this "docking" functionality or trap
> the "docking" event and size and position my root window according to custom
> needs. I've been googling this question and I can't seem to find the right
> terms to describe the event that is being raised or the behavior that I'm
> observing.

It sounds like you are describing the "Aero Snap" feature in Windows
7.  If you want to turn it off system wide, you can do that in the
control panel:

Open the Ease of Access control panel
Click Make it easier to focus on tasks
Check "Prevent windows from being automatically arranged when moved to
the edge of the screen"

I'm afraid I don't have any Tk experience to contribute, but this
Stack Overflow thread may be slightly helpful, even though it's
talking about trying to do this in .NET, and there aren't really any
conclusions reached.
http://stackoverflow.com/questions/2470685/disable-aero-snap-wpf

At a guess the windows message triggering the resize would be a
WM_SIZE.  You may be able to override how your application responds to
those messages to dock the way you want to.  It'll probably take some
experimentation, though.

-- 
Jerry



More information about the Python-list mailing list