[PyQt] QMainWindow app doesn't receive focus until focus out/in on macOS
max.grady at gmail.com
Sat Apr 8 04:06:08 BST 2017
This sounds very similar to an issue I have encountered with PyQt5 on OS X
where the menubar is disabled until you swap focus to another application
then back to python.
To my knowledge its not considered a bug with Qt or PyQt and rather is just
a result of how OS X deals with programs that are run without an app bundle.
Since bundling a python program into an OS X app isn't very
straightforward, my work around has been to execute a short applescript
when the program starts which enters the keystrokes "Cmd+Tab" twice. This
switches to another application then back to the python program. After the
second switch, the menus will work fine.
You could check if that works for you in the mean time while the deeper
cause is sought.
An example of the applescript I use is found here:
the applescript is cmd.scpt, and in main.py you should see the code that
runs the script.
Might be a different problem all together, however.
On Fri, Apr 7, 2017 at 10:18 PM, Patrick Stinson <patrickkidd at gmail.com>
> Hi there!
> I m noticing that often but not always my app doesn’t appear to be the
> current app in the sierra window manager even though the (cmd-tab) app
> switcher says it is. It also doesn’t receive input events when in this
> If I switch to another app and then back to mine everything looks and
> works correctly.
> Something tells me this is a probably well-known bug with a window
> attribute or something that I am just in the dark on.
> Thoughts? Thanks!
> PyQt mailing list PyQt at riverbankcomputing.com
University of New Hampshire
Department of Physics
DeMeritt Hall 119
Síocháin agus Grá
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt