[PyQt] [Bug] PyQt5 version 5.7.0 OS X.11.4 (El Capitan) MenuBar requires defocus + refocus of app to work

Maxwell Grady max.grady at gmail.com
Thu Sep 22 18:03:28 BST 2016


I have a PyQt5 v 5.7.0 app that is cross platform and functioning fine on
Windows 10 and Ubuntu 16.04 however on OS X there is a problem with the
menubar.

When the app is started on OS X, the menubar at the top of the screen
(native menubar location) appears but can not be clicked. Keyboard
shortcuts still work but clicking the menu has no result. If you switch
focus to another program (Cmd+Tab) and then switch focus back to the PyQt
app (Cmd+Tab) then the menu is clickable and functions as normal.

Instead of linking you to my app I have provided a minimum working example:
A blank window (QWidget) with a menubar that has one menu and one item
added to it.
The item simply triggers a method to print("Test ...") and is set to Cmd+t
keyboard shortcut.

Upon launching the program you can see a File menu appears, you can press
cmd+t and it triggers the method to print to sys.stdout, however you can
not click on the File Menu.

If you click your desktop then click back to the app window then suddenly
the File menu fucntions properly.

The code for the minimal working example is listed in a GithubGist here:

https://gist.github.com/mgrady3/8168da3869869ec11a281103014300c8

-Maxwell
-- 
University of New Hampshire
Department of Physics
Pohl Group
DeMeritt Hall 119
---
Síocháin agus Grá
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160922/df5d6317/attachment.html>


More information about the PyQt mailing list