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

David Morris othalan at othalan.net
Sun Sep 25 08:53:11 BST 2016


I have this same issue with PyQt v5.6 on OSX 10.10 (Yosemite).  If I open
my app using python on a command line, menus are not functional until I
switch to another app and switch back.  But if I build an OSX app bundle
(via pyqtdeploy), the menus work perfectly.

I've looked around a bit for the cause of this but never found a solution.

David

On Thu, Sep 22, 2016 at 7:03 PM, Maxwell Grady <max.grady at gmail.com> wrote:

> 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á
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160925/32672e08/attachment.html>


More information about the PyQt mailing list