Setting Focus

G

Gandalf

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
 
H

Hyuga

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

I'm not sure if there's a way to do this purely in wx, as it's sort of
a Windows-specific functionality as far as I know. I know in win32
you can use SetWindowPos() and pass it HWND_TOP (see
http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx). So you
might have to use win32gui to use SetWindowPos(). You can use
wxWindow.getHandle() to get the HWND reference to pass as the first
argument to SetWindowPos.

Erik
 
H

Hyuga

I'm not sure if there's a way to do this purely in wx, as it's sort of
a Windows-specific functionality as far as I know. I know in win32
you can use SetWindowPos() and pass it HWND_TOP (seehttp://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx). So you


Sorry, I meant you actually want HWND_TOPMOST as the second argument
to SetWindowPos(). That puts the window above all other windows and
keeps it there.

Erik
 
M

Mike Driscoll

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top