Setting Focus

Mike Driscoll kyosohma at gmail.com
Fri Jun 13 15:59:31 CEST 2008


On Jun 12, 10:04 pm, Gandalf <goldn... at gmail.com> wrote:
> You know these  application like ICQ or winamp which stay at the front
> of the desktop as long as the user doesn't minimize it. I wont to do
> the same with my application in python.
> I still didn't manage to make pywinauto to auto set my window frame in
> focus reliability so I was hoping this will solve my problem.
>
> I'm working with WX lib on 2.5 python on Microsoft Windows XP
>
> if any one {know / heard /think he know /thunk he heard/ sow once
> article that shows} how to do it  I will be happy to know
>
> thank you in advance

wxPython does indeed support this functionality. You need to research
the style flags of the wx.Frame object though.

When you instantiate your frame, do something like this:

<code>

self.frame = wx.Frame(None, -1, title='My Frame', style=wx.STAY_ON_TOP|
wx.DEFAULT_FRAME_STYLE)

</code>

Notice that I also passed it the wx.DEFAULT_FRAME_STYLE style flag.
This should give you the minimize, maximize and close buttons too. If
you do not pass that extra flag, then the frame will not have that
functionality and you'll have to kill your application from the Task
Manager.

-------------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org
Python Extension Building Network:     http://www.pythonlibrary.org



More information about the Python-list mailing list