[PyQt] Issue with menubar on MacOS X 10.9 and 10.10

Thomas Robitaille thomas.robitaille at gmail.com
Sun Sep 13 15:25:13 BST 2015


Hi everyone,

On MacOS X 10.9 and 10.10 I am seeing buggy behavior with the menubar
in PyQt applications. If I run the following example:

    from PyQt4.QtGui import QApplication, QMainWindow, QMenu

    app = QApplication([''])
    main = QMainWindow()
    mbar = main.menuBar()
    menu = QMenu(mbar)
    menu.setTitle("&File")
    mbar.addMenu(menu)
    main.show()
    main.raise_()
    app.exec_()

Then the window appears and comes to the foreground but the menubar
does not change:

https://i.imgur.com/ouqpo0s.png [screenshot]

Note that the window is in the foreground (the three buttons top left
are colored) but the menubar is whatever it was before I launched the
application. If I then go to another application and come back, then
the menu appears.

However, on MacOS X 10.8 for example, this works correctly. Is this a
known issue? Does anyone know of any workarounds to prevent this issue
from happening?

Thanks!
Tom


More information about the PyQt mailing list