<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>I guess I am wondering <br>
<br>
1. Why it takes so long to load?</p>
<p>2. Why the Edit menu is showing up, yet linked to nothing (and why emoji symbols are a submenu of it)?</p>
<p>3. What the code line for adding an action to a menu item would be? </p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"> (sorry- I am an ambitious beginner)</span><br>
</p>
<p>4. Why the following Tkinter menu works perfectly:<br>
<br>
</p>
<pre style="background-color: rgb(248, 248, 255); font-family: Menlo; font-size: 9pt;"><span style="font-weight:bold;">from </span>tkinter <span style="font-weight:bold;">import *<br></span><span style="font-weight:bold;">from </span>tkinter <span style="font-weight:bold;">import </span>filedialog<br><span style="font-weight:bold;">from </span>tkinter.filedialog <span style="font-weight:bold;">import </span><span style="background-color:#e4e4ff;">askopenfilename</span><br><br><br><span style="font-weight:bold;">def </span><span style="color:#990000;font-weight:bold;">NewFile</span>()<span style="font-weight:bold;">:<br></span><span style="font-weight:bold;"> </span><span style="color:#0086b3;">print</span>(<span style="color:#008080;font-weight:bold;">"New File!"</span>)<br><br><br><span style="font-weight:bold;">def </span><span style="color:#990000;font-weight:bold;">OpenFile</span>()<span style="font-weight:bold;">:<br></span><span style="font-weight:bold;"> </span>name <span style="font-weight:bold;">= </span><span style="background-color:#e4e4ff;">askopenfilename</span>()<br> <span style="color:#0086b3;">print</span>(name)<br><br><br><span style="font-weight:bold;">def </span><span style="color:#990000;font-weight:bold;">About</span>()<span style="font-weight:bold;">:<br></span><span style="font-weight:bold;"> </span><span style="color:#0086b3;">print</span>(<span style="color:#008080;font-weight:bold;">"This is a simple example of a menu"</span>)<br><br><br>root <span style="font-weight:bold;">= </span>Tk()<br>menu <span style="font-weight:bold;">= </span>Menu(root)<br>root.config(<span style="color:#660099;">menu</span><span style="font-weight:bold;">=</span>menu)<br>filemenu <span style="font-weight:bold;">= </span>Menu(menu)<br>menu.add_cascade(<span style="color:#660099;">label</span><span style="font-weight:bold;">=</span><span style="color:#008080;font-weight:bold;">"File"</span>, <span style="color:#660099;">menu</span><span style="font-weight:bold;">=</span>filemenu)<br>filemenu.add_command(<span style="color:#660099;">label</span><span style="font-weight:bold;">=</span><span style="color:#008080;font-weight:bold;">"New"</span>, <span style="color:#660099;">command</span><span style="font-weight:bold;">=</span>NewFile)<br>filemenu.add_command(<span style="color:#660099;">label</span><span style="font-weight:bold;">=</span><span style="color:#008080;font-weight:bold;">"Open..."</span>, <span style="color:#660099;">command</span><span style="font-weight:bold;">=</span>OpenFile)<br>filemenu.add_separator()<br>filemenu.add_command(<span style="color:#660099;">label</span><span style="font-weight:bold;">=</span><span style="color:#008080;font-weight:bold;">"Exit"</span>, <span style="color:#660099;">command</span><span style="font-weight:bold;">=</span>root.quit)<br><br>helpmenu <span style="font-weight:bold;">= </span>Menu(menu)<br>menu.add_cascade(<span style="color:#660099;">label</span><span style="font-weight:bold;">=</span><span style="color:#008080;font-weight:bold;">"Help"</span>, <span style="color:#660099;">menu</span><span style="font-weight:bold;">=</span>helpmenu)<br>helpmenu.add_command(<span style="color:#660099;">label</span><span style="font-weight:bold;">=</span><span style="color:#008080;font-weight:bold;">"About..."</span>, <span style="color:#660099;">command</span><span style="font-weight:bold;">=</span>About)<br><br>mainloop()</pre>
<br>
<p></p>
<p>I got all of these scripts from tutorials so they <i>should</i> work.</p>
<div><br>
</div>
<div>Did the last PyQt code work for you? Any changes you would make for a Mac user? I do not know the specifics.</div>
<div><br>
</div>
<div>
<blockquote type="cite" class="" style="font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;">
<div class="">
<pre class="" style="background-color: rgb(248, 248, 255); font-family: Menlo; font-size: 9pt;"><span class="" style="font-weight: bold;">import </span>sys<br class=""><span class="" style="font-weight: bold;">from </span>PyQt5.QtWidgets <span class="" style="font-weight: bold;">import </span>QMainWindow, QApplication, QWidget, QPushButton, QAction<br class=""><span class="" style="font-weight: bold;">from </span>PyQt5.QtGui <span class="" style="font-weight: bold;">import </span>QIcon<br class=""><span class="" style="font-weight: bold;">from </span>PyQt5.QtCore <span class="" style="font-weight: bold;">import </span>pyqtSlot<br class=""><br class=""><br class=""><span class="" style="font-weight: bold;">class </span><span class="" style="color: rgb(68, 85, 136); font-weight: bold;">App</span>(QMainWindow)<span class="" style="font-weight: bold;">:<br class=""></span><span class="" style="font-weight: bold;"> def </span><span class="" style="color: rgb(178, 0, 178);">__init__</span>(<span class="" style="color: rgb(148, 85, 141);">self</span>)<span class="" style="font-weight: bold;">:<br class=""></span><span class="" style="font-weight: bold;"> </span><span class="" style="color: rgb(0, 134, 179);">super</span>().<span class="" style="color: rgb(0, 134, 179);">__init__</span>()<br class=""> <span class="" style="color: rgb(148, 85, 141);">self</span>.title <span class="" style="font-weight: bold;">= </span><span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'PyQt5 menu - <a href="http://pythonspot.com/" class="" id="LPlnk78267" previewremoved="true">pythonspot.com</a>'<br class=""></span><span class="" style="color: rgb(0, 128, 128); font-weight: bold;"> </span><span class="" style="color: rgb(148, 85, 141);">self</span>.left <span class="" style="font-weight: bold;">= </span><span class="" style="color: rgb(0, 153, 153);">10<br class=""></span><span class="" style="color: rgb(0, 153, 153);"> </span><span class="" style="color: rgb(148, 85, 141);">self</span>.top <span class="" style="font-weight: bold;">= </span><span class="" style="color: rgb(0, 153, 153);">10<br class=""></span><span class="" style="color: rgb(0, 153, 153);"> </span><span class="" style="color: rgb(148, 85, 141);">self</span>.width <span class="" style="font-weight: bold;">= </span><span class="" style="color: rgb(0, 153, 153);">640<br class=""></span><span class="" style="color: rgb(0, 153, 153);"> </span><span class="" style="color: rgb(148, 85, 141);">self</span>.height <span class="" style="font-weight: bold;">= </span><span class="" style="color: rgb(0, 153, 153);">400<br class=""></span><span class="" style="color: rgb(0, 153, 153);"> </span><span class="" style="color: rgb(148, 85, 141);">self</span>.initUI()<br class=""><br class=""> <span class="" style="font-weight: bold;">def </span><span class="" style="color: rgb(153, 0, 0); font-weight: bold;">initUI</span>(<span class="" style="color: rgb(148, 85, 141);">self</span>)<span class="" style="font-weight: bold;">:<br class=""></span><span class="" style="font-weight: bold;"> </span><span class="" style="color: rgb(148, 85, 141);">self</span>.setWindowTitle(<span class="" style="color: rgb(148, 85, 141);">self</span>.title)<br class=""> <span class="" style="color: rgb(148, 85, 141);">self</span>.setGeometry(<span class="" style="color: rgb(148, 85, 141);">self</span>.left, <span class="" style="color: rgb(148, 85, 141);">self</span>.top, <span class="" style="color: rgb(148, 85, 141);">self</span>.width, <span class="" style="color: rgb(148, 85, 141);">self</span>.height)<br class=""><br class=""> mainMenu <span class="" style="font-weight: bold;">= </span><span class="" style="color: rgb(148, 85, 141);">self</span>.menuBar()<br class=""> fileMenu <span class="" style="font-weight: bold;">= </span>mainMenu.addMenu(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'File'</span>)<br class=""> <span class="" style="color: rgb(128, 128, 128);">editMenu </span><span class="" style="font-weight: bold;">= </span>mainMenu.addMenu(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Edit'</span>)<br class=""> <span class="" style="color: rgb(128, 128, 128);">viewMenu </span><span class="" style="font-weight: bold;">= </span>mainMenu.addMenu(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'View'</span>)<br class=""> <span class="" style="color: rgb(128, 128, 128);">searchMenu </span><span class="" style="font-weight: bold;">= </span>mainMenu.addMenu(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Search'</span>)<br class=""> <span class="" style="color: rgb(128, 128, 128);">toolsMenu </span><span class="" style="font-weight: bold;">= </span>mainMenu.addMenu(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Tools'</span>)<br class=""> <span class="" style="color: rgb(128, 128, 128);">helpMenu </span><span class="" style="font-weight: bold;">= </span>mainMenu.addMenu(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Help'</span>)<br class=""><br class=""> exitButton <span class="" style="font-weight: bold;">= </span>QAction(QIcon(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'exit24.png'</span>), <span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Exit'</span>, <span class="" style="color: rgb(148, 85, 141);">self</span>)<br class=""> exitButton.setShortcut(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Ctrl+Q'</span>)<br class=""> exitButton.setStatusTip(<span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'Exit application'</span>)<br class=""> exitButton.triggered.connect(<span class="" style="color: rgb(148, 85, 141);">self</span>.close)<br class=""> fileMenu.addAction(exitButton)<br class=""><br class=""> <span class="" style="color: rgb(148, 85, 141);">self</span>.show()<br class=""><br class=""><br class=""><span class="" style="font-weight: bold;">if </span>__name__ <span class="" style="font-weight: bold;">== </span><span class="" style="color: rgb(0, 128, 128); font-weight: bold;">'__main__'</span><span class="" style="font-weight: bold;">:<br class=""></span><span class="" style="font-weight: bold;"> </span>app <span class="" style="font-weight: bold;">= </span>QApplication(sys.argv)<br class=""> ex <span class="" style="font-weight: bold;">= </span>App()<br class=""> sys.exit(app.exec_())</pre>
</div>
</div>
</div>
</blockquote>
I heard some of these issues will be fixed in May with the release of PyQt 5.9?</div>
<div><br>
</div>
Thanks Barry,
<div><br>
</div>
<div>Grant<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block; width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Barry Scott <barry@barrys-emacs.org><br>
<b>Sent:</b> Monday, March 27, 2017 2:48 AM<br>
<b>To:</b> Grant Fraser<br>
<b>Cc:</b> pyqt@riverbankcomputing.com<br>
<b>Subject:</b> Re: [PyQt] com.apple.xbs Error-- Please help- Thank you</font>
<div> </div>
</div>
<div><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 26 Mar 2017, at 22:18, Grant Fraser <<a href="mailto:grantrf93@hotmail.com" class="">grantrf93@hotmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="font-size:12pt">Nice, I am going to download Barry's Emacs right now.</span><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="font-size:12pt"><br class="">
</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px"><span class="" style="font-size:12pt">The IDE may be getting in the way.</span></div>
<div class="">Why is it working in the terminal but without all the menu buttons?<br class="">
There should be "file" "view" "search" "tools" "help" items in the top menu bar as well.</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
I think it is because you need to add actions to all the menus you added for them to appear.</div>
<div><br class="">
</div>
<div>Barry</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif">
<div class=""><br class="">
</div>
<div class="">I really meant to post this code (my apologies):<br class="">
<br class="">
<pre class="" style="background-color:rgb(248,248,255); font-family:Menlo; font-size:9pt"><span class="" style="font-weight:bold">import </span>sys<br class=""><span class="" style="font-weight:bold">from </span>PyQt5.QtWidgets <span class="" style="font-weight:bold">import </span>QMainWindow, QApplication, QWidget, QPushButton, QAction<br class=""><span class="" style="font-weight:bold">from </span>PyQt5.QtGui <span class="" style="font-weight:bold">import </span>QIcon<br class=""><span class="" style="font-weight:bold">from </span>PyQt5.QtCore <span class="" style="font-weight:bold">import </span>pyqtSlot<br class=""><br class=""><br class=""><span class="" style="font-weight:bold">class </span><span class="" style="color:rgb(68,85,136); font-weight:bold">App</span>(QMainWindow)<span class="" style="font-weight:bold">:<br class=""></span><span class="" style="font-weight:bold"> def </span><span class="" style="color:rgb(178,0,178)">__init__</span>(<span class="" style="color:rgb(148,85,141)">self</span>)<span class="" style="font-weight:bold">:<br class=""></span><span class="" style="font-weight:bold"> </span><span class="" style="color:rgb(0,134,179)">super</span>().<span class="" style="color:rgb(0,134,179)">__init__</span>()<br class=""> <span class="" style="color:rgb(148,85,141)">self</span>.title <span class="" style="font-weight:bold">= </span><span class="" style="color:rgb(0,128,128); font-weight:bold">'PyQt5 menu - <a href="http://pythonspot.com/" class="">pythonspot.com</a>'<br class=""></span><span class="" style="color:rgb(0,128,128); font-weight:bold"> </span><span class="" style="color:rgb(148,85,141)">self</span>.left <span class="" style="font-weight:bold">= </span><span class="" style="color:rgb(0,153,153)">10<br class=""></span><span class="" style="color:rgb(0,153,153)"> </span><span class="" style="color:rgb(148,85,141)">self</span>.top <span class="" style="font-weight:bold">= </span><span class="" style="color:rgb(0,153,153)">10<br class=""></span><span class="" style="color:rgb(0,153,153)"> </span><span class="" style="color:rgb(148,85,141)">self</span>.width <span class="" style="font-weight:bold">= </span><span class="" style="color:rgb(0,153,153)">640<br class=""></span><span class="" style="color:rgb(0,153,153)"> </span><span class="" style="color:rgb(148,85,141)">self</span>.height <span class="" style="font-weight:bold">= </span><span class="" style="color:rgb(0,153,153)">400<br class=""></span><span class="" style="color:rgb(0,153,153)"> </span><span class="" style="color:rgb(148,85,141)">self</span>.initUI()<br class=""><br class=""> <span class="" style="font-weight:bold">def </span><span class="" style="color:rgb(153,0,0); font-weight:bold">initUI</span>(<span class="" style="color:rgb(148,85,141)">self</span>)<span class="" style="font-weight:bold">:<br class=""></span><span class="" style="font-weight:bold"> </span><span class="" style="color:rgb(148,85,141)">self</span>.setWindowTitle(<span class="" style="color:rgb(148,85,141)">self</span>.title)<br class=""> <span class="" style="color:rgb(148,85,141)">self</span>.setGeometry(<span class="" style="color:rgb(148,85,141)">self</span>.left, <span class="" style="color:rgb(148,85,141)">self</span>.top, <span class="" style="color:rgb(148,85,141)">self</span>.width, <span class="" style="color:rgb(148,85,141)">self</span>.height)<br class=""><br class=""> mainMenu <span class="" style="font-weight:bold">= </span><span class="" style="color:rgb(148,85,141)">self</span>.menuBar()<br class=""> fileMenu <span class="" style="font-weight:bold">= </span>mainMenu.addMenu(<span class="" style="color:rgb(0,128,128); font-weight:bold">'File'</span>)<br class=""> <span class="" style="color:rgb(128,128,128)">editMenu </span><span class="" style="font-weight:bold">= </span>mainMenu.addMenu(<span class="" style="color:rgb(0,128,128); font-weight:bold">'Edit'</span>)<br class=""> <span class="" style="color:rgb(128,128,128)">viewMenu </span><span class="" style="font-weight:bold">= </span>mainMenu.addMenu(<span class="" style="color:rgb(0,128,128); font-weight:bold">'View'</span>)<br class=""> <span class="" style="color:rgb(128,128,128)">searchMenu </span><span class="" style="font-weight:bold">= </span>mainMenu.addMenu(<span class="" style="color:rgb(0,128,128); font-weight:bold">'Search'</span>)<br class=""> <span class="" style="color:rgb(128,128,128)">toolsMenu </span><span class="" style="font-weight:bold">= </span>mainMenu.addMenu(<span class="" style="color:rgb(0,128,128); font-weight:bold">'Tools'</span>)<br class=""> <span class="" style="color:rgb(128,128,128)">helpMenu </span><span class="" style="font-weight:bold">= </span>mainMenu.addMenu(<span class="" style="color:rgb(0,128,128); font-weight:bold">'Help'</span>)<br class=""><br class=""> exitButton <span class="" style="font-weight:bold">= </span>QAction(QIcon(<span class="" style="color:rgb(0,128,128); font-weight:bold">'exit24.png'</span>), <span class="" style="color:rgb(0,128,128); font-weight:bold">'Exit'</span>, <span class="" style="color:rgb(148,85,141)">self</span>)<br class=""> exitButton.setShortcut(<span class="" style="color:rgb(0,128,128); font-weight:bold">'Ctrl+Q'</span>)<br class=""> exitButton.setStatusTip(<span class="" style="color:rgb(0,128,128); font-weight:bold">'Exit application'</span>)<br class=""> exitButton.triggered.connect(<span class="" style="color:rgb(148,85,141)">self</span>.close)<br class=""> fileMenu.addAction(exitButton)<br class=""><br class=""> <span class="" style="color:rgb(148,85,141)">self</span>.show()<br class=""><br class=""><br class=""><span class="" style="font-weight:bold">if </span>__name__ <span class="" style="font-weight:bold">== </span><span class="" style="color:rgb(0,128,128); font-weight:bold">'__main__'</span><span class="" style="font-weight:bold">:<br class=""></span><span class="" style="font-weight:bold"> </span>app <span class="" style="font-weight:bold">= </span>QApplication(sys.argv)<br class=""> ex <span class="" style="font-weight:bold">= </span>App()<br class=""> sys.exit(app.exec_())</pre>
If you get a chance, could you please try that out and let me know your results? My results were in the picture attachments. Only getting an Edit bar.<br class="">
<br class="">
Thanks a bunch Barry.</div>
<div class=""><br class="">
</div>
<div class="">Sincerely,</div>
<div class="">Grant<br class="">
<div class="" style="">
<hr class="" style="display:inline-block; width:2053.09375px" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" class="" style="font-size:11pt"><b class="">From:</b><span class="Apple-converted-space"> </span>Barry <<a href="mailto:barry@barrys-emacs.org" class="">barry@barrys-emacs.org</a>><br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Sunday, March 26, 2017 4:00 PM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>Grant Fraser<br class="">
<b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:pyqt@riverbankcomputing.com" class="">pyqt@riverbankcomputing.com</a><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [PyQt] com.apple.xbs Error-- Please help- Thank you</font>
<div class=""> </div>
</div>
<div class="">
<div class=""></div>
<div class="">I don't use an IDE.</div>
<div class=""><br class="">
</div>
<div class="">I use Barry's Emacs and the editor and a terminal shell to ru the code.</div>
<div class=""><br class="">
</div>
<div class="">It seems the IDE is getting in your way.</div>
<div class=""><br class="">
</div>
<div class="">The menus are exactly as expected on macOS as I remarked.</div>
<div class=""><br class="">
</div>
<div class="">Barry</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
On 26 Mar 2017, at 20:26, Grant Fraser <<a href="mailto:grantrf93@hotmail.com" class="">grantrf93@hotmail.com</a>> wrote:<br class="">
<br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px">That is extremely odd.</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Site with tutorials: <a href="https://pythonspot.com/en/pyqt5/" class="OWAAutoLink" id="LPlnk865514" previewremoved="true">https://pythonspot.com/en/pyqt5/</a><br class="">
Menu code that causes error for me <a href="https://pythonspot.com/en/pyqt5-menu/" class="OWAAutoLink" id="LPlnk482602" previewremoved="true">https://pythonspot.com/en/pyqt5-menu/</a><br class="">
</div>
<div id="LPBorder_GT_14905558568340.7025038029137942" class="" style="margin-bottom:20px; overflow:auto; width:2085px; text-indent:0px">
<table id="LPContainer_14905558568320.2733705825302566" cellspacing="0" class="" style="width:1876.5px; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top-width:1px; border-top-style:dotted; border-top-color:rgb(200,200,200); border-bottom-width:1px; border-bottom-style:dotted; border-bottom-color:rgb(200,200,200)">
<tbody class="">
<tr valign="top" class="" style="border-spacing:0px">
<td id="TextCell_14905558568330.06978902659263309" colspan="2" class="" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_14905558568330.8102605280591344" class=""></div>
<div id="LPTitle_14905558568330.24243086588784535" class="" style="top:0px; color:rgb(0,120,215); font-weight:normal; font-size:21px; font-family:wf_segoe-ui_light,'Segoe UI Light','Segoe WP Light','Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_14905558568330.8462167529740874" href="https://pythonspot.com/en/pyqt5/" target="_blank" class="" style="text-decoration:none">PyQT5 – Python Tutorial</a></div>
<div id="LPMetadata_14905558568330.8864540214841465" class="" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
<a href="http://pythonspot.com/" class="">pythonspot.com</a></div>
<div id="LPDescription_14905558568340.6611972607316958" class="" style="display:block; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
PyQt5 is a module that can be used to create graphical user interfaces (GUI). PyQt5 is not backwards compatible with PyQt4. You will need Python 2.6+ or newer.</div>
</td>
</tr>
</tbody>
</table>
</div>
I am on a Mac 10.12.3<br class="">
Python 3.6
<p class="" style="margin-top:0px; margin-bottom:0px"></p>
<div class=""><br class="">
</div>
The file partially works in terminal but not in PyCharm. The only menu bar items I receive are "python3" and "edit" though. They load extremely slowly and I am on a really good laptop.
<div class="">Screenshots attached.<br class="">
<div class=""><br class="">
<div class="">How many menu bar items do you receive ?</div>
<div class="">No view, tools, search, or help menu bar items, like the program seems to supposedly create.</div>
<div class=""><br class="">
</div>
<div class="">I do not know why I am not receiving all of the menu bar items.<br class="">
<br class="">
In PyCharm the full error I receive is <a href="http://pastebin.com/RJ3gnrAT" class="OWAAutoLink" id="LPlnk136734" previewremoved="true">http://pastebin.com/RJ3gnrAT</a></div>
<div id="LPBorder_GT_14905556915640.026633137462332535" class="" style="margin-bottom:20px; overflow:auto; width:2085px; text-indent:0px">
<table id="LPContainer_14905556915610.2512137335813833" cellspacing="0" class="" style="width:1876.5px; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top-width:1px; border-top-style:dotted; border-top-color:rgb(200,200,200); border-bottom-width:1px; border-bottom-style:dotted; border-bottom-color:rgb(200,200,200)">
<tbody class="">
<tr valign="top" class="" style="border-spacing:0px">
<td id="ImageCell_14905556915620.45661880606089" colspan="1" class="" style="width:250px; display:table-cell; padding-right:20px">
<div id="LPImageContainer_14905556915620.3578158883545095" class="" style="background-color:rgb(255,255,255); height:250px; margin:auto; display:table; width:250px">
<a id="LPImageAnchor_14905556915620.7513514414735187" href="http://pastebin.com/RJ3gnrAT" target="_blank" class="" style="display:table-cell; text-align:center"><img id="LPThumbnailImageID_14905556915620.18384012432091779" width="250" height="250" class="" style="display:inline-block; max-width:250px; max-height:250px; height:250px; width:250px; border-width:0px; vertical-align:bottom" src="http://pastebin.com/i/facebook.png"></a></div>
</td>
<td id="TextCell_14905556915630.7679616588952209" colspan="2" class="" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_14905556915630.8223285960389648" class=""></div>
<div id="LPTitle_14905556915630.5885875927716291" class="" style="top:0px; color:rgb(0,120,215); font-weight:normal; font-size:21px; font-family:wf_segoe-ui_light,'Segoe UI Light','Segoe WP Light','Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_14905556915630.5270177408890231" href="http://pastebin.com/RJ3gnrAT" target="_blank" class="" style="text-decoration:none">Process: Python [9764] Path: /usr/local/Cellar/p - Pastebin.com</a></div>
<div id="LPMetadata_14905556915630.7741633743554606" class="" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
<a href="http://pastebin.com/" class="">pastebin.com</a></div>
</td>
</tr>
</tbody>
</table>
</div>
<br class="">
<div class="">Additionally have you tried running this program in one of your IDEs without errors?</div>
<div class=""><br class="">
</div>
<div class="">Thanks a bunch,</div>
<div class=""><br class="">
Grant</div>
<div class=""><br class="">
<div class="" style="">
<hr class="" style="display:inline-block; width:2043.296875px" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" class="" style="font-size:11pt"><b class="">From:</b><span class="Apple-converted-space"> </span>Barry Scott <<a href="mailto:barry@barrys-emacs.org" class="">barry@barrys-emacs.org</a>><br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Sunday, March 26, 2017 7:41 AM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>Grant Fraser<br class="">
<b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:pyqt@riverbankcomputing.com" class="">pyqt@riverbankcomputing.com</a><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [PyQt] com.apple.xbs Error-- Please help- Thank you</font>
<div class=""> </div>
</div>
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 25 Mar 2017, at 17:25, Grant Fraser <<a href="mailto:grantrf93@hotmail.com" class="">grantrf93@hotmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif">
<p class="" style="margin-top:0px; margin-bottom:0px"></p>
<div class="" style="margin:0px 0px 0.357143em; padding:0px; font-size:14px; line-height:1.42857em; color:rgb(34,34,34); font-family:verdana,arial,helvetica,sans-serif">
Mac OS Python 3 PyQt5</div>
<div class="" style="margin:0px 0px 0.357143em; padding:0px; font-size:14px; line-height:1.42857em; color:rgb(34,34,34); font-family:verdana,arial,helvetica,sans-serif">
Program that causes error from tutorial but 'works' for the site owner (<a href="http://zetcode.com/gui/pyqt5/menustoolbars/" class="OWAAutoLink" id="LPlnk245749" previewremoved="true">http://zetcode.com/gui/pyqt5/menustoolbars/</a>):</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">I ran the code in your email and it works error free.</div>
<div class=""><br class="">
</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>macOs 10.12.3</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>python 3.5.2 and 3.6.0 with PyQt5 5.7 and 5.8.1</div>
<div class=""><br class="">
</div>
<div class="">What versions are you using?</div>
<div class=""><br class="">
</div>
<div class="">I put your code into file a.py and run it from the command line as:</div>
<div class=""><br class="">
</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>$ python3.6 a.py</div>
<div class=""><br class="">
</div>
<div class="">Note: that this example bumps into macOS specific handling of menus.</div>
<div class=""><br class="">
</div>
<div class="">The File>Exit menu is automatically moved to the Python menu as Quit with Cmd-Q as the short cut the icon does show up.</div>
<div class=""><br class="">
</div>
<div class="">Barry</div>
<div class=""><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif">
<div id="LPBorder_GT_14904625682230.5789634353815705" class="" style="margin-bottom:20px; overflow:auto; width:2075px; text-indent:0px">
<table id="LPContainer_14904625682210.6394801620665909" cellspacing="0" class="" style="width:1867.5px; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top-width:1px; border-top-style:dotted; border-top-color:rgb(200,200,200); border-bottom-width:1px; border-bottom-style:dotted; border-bottom-color:rgb(200,200,200)">
<tbody class="">
<tr valign="top" class="" style="border-spacing:0px">
<td id="TextCell_14904625682220.21805416462880256" colspan="2" class="" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_14904625682220.31439469499314665" class=""></div>
<div id="LPTitle_14904625682220.7032952214150816" class="" style="top:0px; color:rgb(0,120,215); font-weight:normal; font-size:21px; font-family:wf_segoe-ui_light,'Segoe UI Light','Segoe WP Light','Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; line-height:21px">
<a id="LPUrlAnchor_14904625682220.5164088187193381" href="http://zetcode.com/gui/pyqt5/menustoolbars/" target="_blank" class="" style="text-decoration:none">Menus and toolbars in PyQt5 - ZetCode</a></div>
<div id="LPMetadata_14904625682220.160844406479568" class="" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
<a href="http://zetcode.com/" class="">zetcode.com</a></div>
<div id="LPDescription_14904625682230.4296130138219205" class="" style="display:block; color:rgb(102,102,102); font-weight:normal; font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
Menus and toolbars in PyQt5. In this part of the PyQt5 tutorial, we will create menus and toolbars. A menu is a group of commands located in a menubar.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br class="">
<pre class="" style="margin-top:0.357143em; margin-bottom:0.357143em; padding:4px 9px; border:1px solid rgb(230,230,222); border-top-left-radius:2px; border-top-right-radius:2px; border-bottom-right-radius:2px; border-bottom-left-radius:2px; overflow:auto; color:rgb(34,34,34)"><code class="" style="font-family:monospace,monospace; margin:0px 2px; border:0px; background-color:transparent; border-top-left-radius:2px; border-top-right-radius:2px; border-bottom-right-radius:2px; border-bottom-left-radius:2px; word-break:normal; display:block; font-size:1em; line-height:1.42857em; padding:0px!important">import sys
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
from PyQt5.QtGui import QIcon
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
exitAction = QAction(QIcon('exit.png'), '&Exit', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip('Exit application')
exitAction.triggered.connect(qApp.quit)
self.statusBar()
menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(exitAction)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Menubar')
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
</code></pre>
<div class="" style="margin:0.357143em 0px; padding:0px; font-size:14px; line-height:1.42857em; color:rgb(34,34,34); font-family:verdana,arial,helvetica,sans-serif">
Error:</div>
<pre class="" style="margin-top:0.357143em; margin-bottom:0.357143em; padding:4px 9px; border:1px solid rgb(230,230,222); border-top-left-radius:2px; border-top-right-radius:2px; border-bottom-right-radius:2px; border-bottom-left-radius:2px; overflow:auto; color:rgb(34,34,34)"><code class="" style="font-family:monospace,monospace; margin:0px 2px; border:0px; background-color:transparent; border-top-left-radius:2px; border-top-right-radius:2px; border-bottom-right-radius:2px; border-bottom-left-radius:2px; word-break:normal; display:block; font-size:1em; line-height:1.42857em; padding:0px!important">2017-03-23 23:25:08.606 Python[96170:2827344] *** Assertion failure in -[NSBitmapImageRep initWithCGImage:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1504.81.100/AppKit.subproj/NSBitmapImageRep.m:1296
2017-03-23 23:25:08.608 Python[96170:2827344] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: cgImage != NULL'
</code></pre>
<div class="" style="margin:0.357143em 0px; padding:0px; font-size:14px; line-height:1.42857em; color:rgb(34,34,34); font-family:verdana,arial,helvetica,sans-serif">
*I have looked everywhere for this com.apple.xbs folder, including other computers. I cannot find it anywhere on other computers or online. What is the issue? Apparently it is only for developers? I have signed up as a developer and still cannot find it. I
do not see the correlation between apple and this PyQt5 program though. I also do not see anywhere in the code that would mention needing this folder.</div>
<div class="" style="margin:0.357143em 0px; padding:0px; font-size:14px; line-height:1.42857em; color:rgb(34,34,34); font-family:verdana,arial,helvetica,sans-serif">
*I have even checked hidden folders.</div>
<div class="" style="margin:0.357143em 0px 0px; padding:0px; font-size:14px; line-height:1.42857em; color:rgb(34,34,34); font-family:verdana,arial,helvetica,sans-serif">
*Perhaps you could try running it yourself and seeing if you get the same error. I would really appreciate any help. Thank you.</div>
<br class="">
<p class="" style="margin-top:0px; margin-bottom:0px"></p>
</div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; float:none; display:inline!important">PyQt
mailing list </span><a href="mailto:PyQt@riverbankcomputing.com" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">PyQt@riverbankcomputing.com</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite" class="">
<div class=""><Screen Shot 2017-03-26 at 2.22.23 PM.png></div>
</blockquote>
<blockquote type="cite" class="">
<div class=""><Screen Shot 2017-03-26 at 2.22.15 PM.png></div>
</blockquote>
<blockquote type="cite" class="">
<div class=""><Screen Shot 2017-03-26 at 2.21.47 PM.png></div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>