views:

167

answers:

1

I would like to create an application that has 3-4 frames (or windows) where each frame is attached/positioned to a side of the screen (like a task bar). When a frame is inactive I would like it to auto hide (just like the Windows task bar does; or the dock in OSX). When I move my mouse pointer to the position on the edge of the screen where the frame is hidden, I would like it to come back into focus.

The application is written in Python (using wxPython for the basic GUI aspects). Does anyone know how to do this in Python? I'm guessing it's probably OS dependent? If so, I'd like to focus on Windows first.

I don't do GUI programming very often so my apologies if this makes no sense at all.

Thanks in advance.

A: 

As far as I know, there's nothing built in for this.

When the window is hidden, do you want it completely invisible or can a border of a few pixels be showing? That would be an easy way to get a mouse hover event. Otherwise you might have to use something like pyHook to get system-wide mouse events to know when to expand your window.

The events EVT_ENTER_WINDOW and EVT_LEAVE_WINDOW might also be useful here to know when the user has entered/left the window so you can expand/collapse it.

Expanding/collapsing can just be done by showing/hiding windows or resizing them. Standard window functions, nothing fancy.

By the way, you might want to use wx.ClientDisplayRect to figure out where to position your window. That will give you a rectangle of the desktop that does NOT include the task bar or any other toolbars the user has, assuming you want to avoid overlapping with those things.

FogleBird
thanks, very helpful :). My initial thoughts were that a few pixels would be visible so I could make use of events like that. Although, I have a feeling my client probably prefers otherwise ...
Jason