What is the best way to have the functionality of 2 active windows?
To my knowledge, it is impossible to have two windows from separate
applications active at the same time in Windows, but that may be incorrect.
I am using a protein viewer (PyMOL) alongside wxPython and pywin32 to
control window interactions, but I am having a notable problem. I have a
blank panel as a stand-in for the viewer window in my wxPython application,
and I use pywin32 to make the actual viewer window mimic the size and
positioning of that panel.
This works, but any time that I click on the wxPython interface, the viewer
loses focus and is hidden behind the stand-in panel. I thought of refocusing
the viewer window automatically, but this makes using the wxPython app
effectively impossible. I saw that MDI windows are now deprecated by
Microsoft, so I was trying to avoid using them. Can you think of another way
to have two windows clickable and visible at the same time?
What is the best way to have the functionality of 2 active windows?
To my knowledge, it is impossible to have two windows from separate
applications active at the same time in Windows, but that may be incorrect.
That depends on your definition of "active". Only one window at a time
can have input focus. It's not clear how you could do things any
differently. You can certainly click buttons on top-level windows that
are not on top of the stack, although doing so brings that window to the
top.
This works, but any time that I click on the wxPython interface, the viewer
loses focus and is hidden behind the stand-in panel. I thought of refocusing
the viewer window automatically, but this makes using the wxPython app
effectively impossible. I saw that MDI windows are now deprecated by
Microsoft, so I was trying to avoid using them. Can you think of another way
to have two windows clickable and visible at the same time?
You can certainly have two windows clickable and visible at the same
time. I have four top-level windows open right now, and all are
clickable. Your problem, I think, is that the windows overlap each
other. Conceptually, how would you solve that? You want input to go to
the window in front.
The fact that MDI is not currently in vogue does not mean you shouldn't
use it if it solves your problem, although it's not clear to me how it
would help you here.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Why not make your wx application a square of separate windows around
your viewer window?
···
On 25/02/13 20:46, Tim Roberts wrote:
womesiete wrote:
What is the best way to have the functionality of 2 active windows?
To my knowledge, it is impossible to have two windows from separate
applications active at the same time in Windows, but that may be incorrect.
That depends on your definition of "active". Only one window at a time
can have input focus. It's not clear how you could do things any
differently. You can certainly click buttons on top-level windows that
are not on top of the stack, although doing so brings that window to the
top.
This works, but any time that I click on the wxPython interface, the viewer
loses focus and is hidden behind the stand-in panel. I thought of refocusing
the viewer window automatically, but this makes using the wxPython app
effectively impossible. I saw that MDI windows are now deprecated by
Microsoft, so I was trying to avoid using them. Can you think of another way
to have two windows clickable and visible at the same time?
You can certainly have two windows clickable and visible at the same
time. I have four top-level windows open right now, and all are
clickable. Your problem, I think, is that the windows overlap each
other. Conceptually, how would you solve that? You want input to go to
the window in front.
The fact that MDI is not currently in vogue does not mean you shouldn't
use it if it solves your problem, although it's not clear to me how it
would help you here.
I could simply have the two windows (viewer and my application) side by side,
or have my application as the child frame of a larger window, but I was
attempting to unify the user interface as much as possible.
This application is for use in a laboratory by multiple people, so I was
more worried about potential compatibility issues with MDI frames on other
people's systems, but I suppose that I have never personally had issues, so
I can just hope that other people will not either.
Would it be possible to convert a window created with wx.Window_FromHWND
into a MDI child frame? I have never worked with MDI frames that were not
created originally in wxPython.
I could simply have the two windows (viewer and my application) side by side,
or have my application as the child frame of a larger window, but I was
attempting to unify the user interface as much as possible.
This application is for use in a laboratory by multiple people, so I was
more worried about potential compatibility issues with MDI frames on other
people's systems, but I suppose that I have never personally had issues, so
I can just hope that other people will not either.
Would it be possible to convert a window created with wx.Window_FromHWND
into a MDI child frame? I have never worked with MDI frames that were not
created originally in wxPython.
If you have the viewer window hwnd in your app, you can try to get the viewer window position and change it with GetWindowRect and SetWindowRect apis:
For anyone wondering, I kept one encapsulating border Frame, the viewer
window, and another stripped down frame without a taskbar button or any
window controls(effectively a panel), and then forced parent-child behavior
to pass to the inner windows using win32gui and wxpython events.
<http://wxpython-users.1045709.n5.nabble.com/file/n5716297/nIOe8ZR.png>
This gives full functionality and visibility to all parts of the workspace,
but it requires another frame object to be running.
For anyone wondering, I kept one encapsulating border Frame, the viewer
window, and another stripped down frame without a taskbar button or any
window controls(effectively a panel), and then forced parent-child behavior
to pass to the inner windows using win32gui and wxpython events.
<http://wxpython-users.1045709.n5.nabble.com/file/n5716297/nIOe8ZR.png>
Why not use e.g. wx.lib.agw.aui for something like that? You don't need win32gui and gives potentially more "layout freedom" to the user.