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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Maxwell Grady
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    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

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

Andreas Pakulat
Hi,

On Thu, Sep 22, 2016 at 7:03 PM, Maxwell Grady <[hidden email]> 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.

I don't think this is a PyQt issue or even Qt one, I suspect this is
related to the app bundle you use for the application or lack of it. I
see exactly the same issue with an Eclipse based application when
starting it from inside Eclipse (which directly runs java with some
commandline arguments). When launching the final build of the
application through an app bundle everything is working fine.

So I suspect that this is related to having an app bundle or some
setting within the app bundle.

Andreas
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

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

Maxwell Grady
(realized I didn't hit reply all)
To clarify, my code is not part of an app or app bundle and is just run from the command line. The minimal working example to reproduce the bug that I included is also run just from the command line and is not part of an app nor app bundle.

Simply invoking " python pyqt5-testmenubar.py" from the command line will run the code and show the bug.

On Thu, Sep 22, 2016 at 1:45 PM, Andreas Pakulat <[hidden email]> wrote:
Hi,

On Thu, Sep 22, 2016 at 7:03 PM, Maxwell Grady <[hidden email]> 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.

I don't think this is a PyQt issue or even Qt one, I suspect this is
related to the app bundle you use for the application or lack of it. I
see exactly the same issue with an Eclipse based application when
starting it from inside Eclipse (which directly runs java with some
commandline arguments). When launching the final build of the
application through an app bundle everything is working fine.

So I suspect that this is related to having an app bundle or some
setting within the app bundle.

Andreas



--
University of New Hampshire
Department of Physics
Pohl Group
DeMeritt Hall 119
---
Síocháin agus Grá

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

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

Naveen Michaud-Agrawal

What distribution of python are you running? Perhaps try "pythonw" to start the application.

Naveen Michaud-Agrawal


On Sep 24, 2016 1:41 PM, "Maxwell Grady" <[hidden email]> wrote:
(realized I didn't hit reply all)
To clarify, my code is not part of an app or app bundle and is just run from the command line. The minimal working example to reproduce the bug that I included is also run just from the command line and is not part of an app nor app bundle.

Simply invoking " python pyqt5-testmenubar.py" from the command line will run the code and show the bug.

On Thu, Sep 22, 2016 at 1:45 PM, Andreas Pakulat <[hidden email]> wrote:
Hi,

On Thu, Sep 22, 2016 at 7:03 PM, Maxwell Grady <[hidden email]> 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.

I don't think this is a PyQt issue or even Qt one, I suspect this is
related to the app bundle you use for the application or lack of it. I
see exactly the same issue with an Eclipse based application when
starting it from inside Eclipse (which directly runs java with some
commandline arguments). When launching the final build of the
application through an app bundle everything is working fine.

So I suspect that this is related to having an app bundle or some
setting within the app bundle.

Andreas



--
University of New Hampshire
Department of Physics
Pohl Group
DeMeritt Hall 119
---
Síocháin agus Grá

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

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

Maxwell Grady
This is python 3.5 from Anaconda (isolated in a conda env) with PyQt installed through pip.
By default a conda env doesn't come with pythonw but I guess I could symlink the file from the main conda install or just run 'conda install python.app' 

I can check if that change's anything on Monday.

On Sat, Sep 24, 2016 at 2:23 PM, Naveen Michaud-Agrawal <[hidden email]> wrote:

What distribution of python are you running? Perhaps try "pythonw" to start the application.

Naveen Michaud-Agrawal


On Sep 24, 2016 1:41 PM, "Maxwell Grady" <[hidden email]> wrote:
(realized I didn't hit reply all)
To clarify, my code is not part of an app or app bundle and is just run from the command line. The minimal working example to reproduce the bug that I included is also run just from the command line and is not part of an app nor app bundle.

Simply invoking " python pyqt5-testmenubar.py" from the command line will run the code and show the bug.

On Thu, Sep 22, 2016 at 1:45 PM, Andreas Pakulat <[hidden email]> wrote:
Hi,

On Thu, Sep 22, 2016 at 7:03 PM, Maxwell Grady <[hidden email]> 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.

I don't think this is a PyQt issue or even Qt one, I suspect this is
related to the app bundle you use for the application or lack of it. I
see exactly the same issue with an Eclipse based application when
starting it from inside Eclipse (which directly runs java with some
commandline arguments). When launching the final build of the
application through an app bundle everything is working fine.

So I suspect that this is related to having an app bundle or some
setting within the app bundle.

Andreas



--
University of New Hampshire
Department of Physics
Pohl Group
DeMeritt Hall 119
---
Síocháin agus Grá

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt



--
University of New Hampshire
Department of Physics
Pohl Group
DeMeritt Hall 119
---
Síocháin agus Grá

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

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

David Morris
In reply to this post by Maxwell Grady
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 <[hidden email]> 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    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt