How To Find The Active Pyqt Window And Bring It To The Front
Solution 1:
A complete, platform-indepenent solution is probably going to be beyond reach. Each of the platforms supported by Qt behaves in a different way, and activateWindow
seems to be somewhat buggy.
To start with, here's what the Qt docs say about activateWindow
:
This function performs the same operation as clicking the mouse on the title bar of a top-level window. On X11, the result depends on the Window Manager. If you want to ensure that the window is stacked on top as well you should also call raise(). Note that the window must be visible, otherwise activateWindow() has no effect.
and:
On Windows, if you are calling this when the application is not currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way. This is because Microsoft does not allow an application to interrupt what the user is currently doing in another application.
For more confirming evidence of the difficulties, take a look at these threads on the Qt forum:
Post a Comment for "How To Find The Active Pyqt Window And Bring It To The Front"