<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi Dave,</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">No, no, I'm running either from the IDE (PyCharm) or the command line (Python menus.py). <br><br>Met vriendelijke groet,<div><br></div><div>Marcel</div></div><div><br>On 5 jun. 2016, at 22:01, David Cortesi <<a href="mailto:davecortesi@gmail.com">davecortesi@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div><div>Ah. How are you running this program? e.g. from a command line, python myscript.py , or how?<br><br></div>What you describe sounds like a problem with an app after it was bundled by PyInstaller. Owing to the lack of some magical incantation in the app's info.plist, the app's menus would not appear when it was launched, but if it was hidden (or if another app was made active), when it came again to the front, its menus did appear.<br><br></div>That has been fixed for PyInstaller with the latest (3.2) version. Anyway, the code I showed you should work.<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 5, 2016 at 11:57 AM, Marcel Maré <span dir="ltr"><<a href="mailto:list@webtothemax.com" target="_blank">list@webtothemax.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi<div><br></div><div>Think I found out some more. </div><div><br></div><div>To rule out a programming error on my part (bering new to Qt) I only looked at the menus.py example (Qt/examples/mainwindows/menus.py). </div><div><br></div><div>The relevant menu definition sections is like this:</div><div><br></div><div><pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'Menlo';font-size:10.5pt"><span style="color:#cc7832;font-weight:bold">def </span><span style="font-weight:bold">createMenus</span>(<span style="color:#94558d">self</span>):<br> <span style="color:#94558d">self</span>.fileMenu = <span style="color:#94558d">self</span>.menuBar().addMenu(<span style="color:#008080">"&File"</span>)<br> <span style="color:#94558d">self</span>.fileMenu.addAction(<span style="color:#94558d">self</span>.newAct)<br> <span style="color:#94558d">self</span>.fileMenu.addAction(<span style="color:#94558d">self</span>.openAct)<br> <span style="color:#94558d">self</span>.fileMenu.addAction(<span style="color:#94558d">self</span>.saveAct)<br> <span style="color:#94558d">self</span>.fileMenu.addAction(<span style="color:#94558d">self</span>.printAct)<br> <span style="color:#94558d">self</span>.fileMenu.addSeparator()<br> <span style="color:#94558d">self</span>.fileMenu.addAction(<span style="color:#94558d">self</span>.exitAct)<br><br> <span style="color:#94558d">self</span>.editMenu = <span style="color:#94558d">self</span>.menuBar().addMenu(<span style="color:#008080">"&Edit"</span>)<br> <span style="color:#94558d">self</span>.editMenu.addAction(<span style="color:#94558d">self</span>.undoAct)<br> <span style="color:#94558d">self</span>.editMenu.addAction(<span style="color:#94558d">self</span>.redoAct)<br> <span style="color:#94558d">self</span>.editMenu.addSeparator()<br> <span style="color:#94558d">self</span>.editMenu.addAction(<span style="color:#94558d">self</span>.cutAct)<br> <span style="color:#94558d">self</span>.editMenu.addAction(<span style="color:#94558d">self</span>.copyAct)<br> <span style="color:#94558d">self</span>.editMenu.addAction(<span style="color:#94558d">self</span>.pasteAct)<br> <span style="color:#94558d">self</span>.editMenu.addSeparator()<br></pre><div><br></div></div><div>So, since it uses self.menuBar() it should not be compatible with the system menu on OSX, since it does not use QMenuBar(). </div><div><br></div><div>Wat I found out that is that when I run the program the menu is visible but unclickable (as reported earlier). However, when I switch to some other program and then back to the menus.py program the menu works!</div><div>Looks like a bug to me.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Marcel </div></font></span><div><div class="h5"><div><br></div><div><br></div><div><br><div><blockquote type="cite"><div>On 05 Jun 2016, at 18:42, David Cortesi <<a href="mailto:davecortesi@gmail.com" target="_blank">davecortesi@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div><div>I have a PyQt5 app that works well in Mac OS, Linux and Windows. The only difference I see in the setup of my QMainWindow is this:<br><br> import platform<br> if platform.uname().system.startswith('Darw') :<br> self._menu_bar = QMenuBar() # parentless menu bar for Mac OS<br> else :<br> self._menu_bar = self.menuBar() # refer to the default one<br><br></div>and then it proceeds to initialize self._menu_bar with menus, e.g.<br><br> self.file_menu = self._menu_bar.addMenu(_TR('Menu name', '&File'))<br> work = self.file_menu.addAction( _TR('File menu command','&New') )<br> work.setShortcut(QKeySequence.New)<br> work.setToolTip( _TR('File:New tooltip','Create a new, empty document') )<br> work.triggered.connect(self._new)<br><br></div>and so forth. The above test of platform.uname() is about the only platform difference in the whole app...<br></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</div></blockquote></body></html>