473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Setting Focus

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
Jun 27 '08 #1
3 3108
On Jun 12, 11:04 pm, Gandalf <goldn...@gmail.comwrote:
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/libr...5(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
Jun 27 '08 #2
On Jun 13, 9:34 am, Hyuga <hyugaricd...@gmail.comwrote:
On Jun 12, 11:04 pm, Gandalf <goldn...@gmail.comwrote:
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


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
Jun 27 '08 #3
On Jun 12, 10:04*pm, Gandalf <goldn...@gmail.comwrote:
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
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jesper Dannemamm | last post by:
Hi I am having trouble setting focus on I tried using this script in the usercontrol's page_load sub to set focus on a textbox with the ID = "user_name": Page.RegisterStartupScript("focus",...
20
by: Arne | last post by:
During testing <div style="overflow:auto;"> in CSS I noticed the mousewheel would work in Mozilla only after I made a <a href="#">some text</a> link and clicked on that, within the div. It...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
2
by: Mystery Man | last post by:
We have an MDI application that is not setting always setting focus to the newly corrected MDI. It is creating the form and it is the topmost but it does not have focus. The code we are using to...
3
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There...
3
by: Brian Henry | last post by:
Hi, I have a bunch of forms in a DLL that I call from my main application. The one form is a login form, and I have the tab order set in the order I want it (password box first, then ok button...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers...
7
by: Zytan | last post by:
I want to set a control in a form to have the default focus. This is not the accept button -- that's set to a button when is 'clicked' when you press ENTER. I want a textbox to have the focus...
5
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered...
3
by: kelvin.koogan | last post by:
I have a number of controls on a tab page. I want to validate them all when the user tries to leave the tab. I then want to highlight the first control which fails validation. How can I do this? I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.