Search code examples
pythonmacospyqt4python-3.4cx-freeze

Setting the mac task bar menu with pyqt4 and then applying cx_freeze


I have a gui that has a mac task bar menu, see below: enter image description here

The first 3 items on the menu were created using QtDesigner and their sub items and actions connect fine. I created the extra "file" dynamically to see if this would fix the problem. This menu appears exactly the same when I build it using python3 setup.py build and then run the executable produced. When I produce a mac app using python3 setup.py bdist_mac however this menu doesn't appear, and instead I just get:

enter image description here

So I'm wondering why this occurs and if there's any files I'm missing in order to have the app pick up my menu. I'm guessing I need to generate qt_menu.nib which I think is where menu actions are meant to be stored, but I can't find how to generate that from the designer.

Using Python 3.4, latest version of cx_freeze, Mac OS X Yosemite and PyQt4.


Solution

  • I'm not really sure why this wasn't working, or why my method fixed it, but I did 2 things to prevent the menu messing up: 1. I had been loading another main window before loading this one which was a smaller setup window. I now load this only when needed.

    1. I was applying a stylesheet. For some reason whenever I apply that now the menu doesn't work. Again, clueless as to why.