<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><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" style="font-style: normal; font-variant-caps: 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; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Nice, I am going to download Barry's Emacs right now.</span><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">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" style="font-style: normal; font-variant-caps: 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; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;" class=""><div class=""><br class=""></div><div class="">I really meant to post this code (my apologies):<br class=""><br class=""><pre style="background-color: rgb(248, 248, 255); font-family: Menlo; font-size: 9pt;" class=""><span style="font-weight: bold;" class="">import </span>sys<br class=""><span style="font-weight: bold;" class="">from </span>PyQt5.QtWidgets <span style="font-weight: bold;" class="">import </span>QMainWindow, QApplication, QWidget, QPushButton, QAction<br class=""><span style="font-weight: bold;" class="">from </span>PyQt5.QtGui <span style="font-weight: bold;" class="">import </span>QIcon<br class=""><span style="font-weight: bold;" class="">from </span>PyQt5.QtCore <span style="font-weight: bold;" class="">import </span>pyqtSlot<br class=""><br class=""><br class=""><span style="font-weight: bold;" class="">class </span><span style="color: rgb(68, 85, 136); font-weight: bold;" class="">App</span>(QMainWindow)<span style="font-weight: bold;" class="">:<br class=""></span><span style="font-weight: bold;" class=""> def </span><span style="color: rgb(178, 0, 178);" class="">__init__</span>(<span style="color: rgb(148, 85, 141);" class="">self</span>)<span style="font-weight: bold;" class="">:<br class=""></span><span style="font-weight: bold;" class=""> </span><span style="color: rgb(0, 134, 179);" class="">super</span>().<span style="color: rgb(0, 134, 179);" class="">__init__</span>()<br class=""> <span style="color: rgb(148, 85, 141);" class="">self</span>.title <span style="font-weight: bold;" class="">= </span><span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'PyQt5 menu - <a href="http://pythonspot.com/" class="">pythonspot.com</a>'<br class=""></span><span style="color: rgb(0, 128, 128); font-weight: bold;" class=""> </span><span style="color: rgb(148, 85, 141);" class="">self</span>.left <span style="font-weight: bold;" class="">= </span><span style="color: rgb(0, 153, 153);" class="">10<br class=""></span><span style="color: rgb(0, 153, 153);" class=""> </span><span style="color: rgb(148, 85, 141);" class="">self</span>.top <span style="font-weight: bold;" class="">= </span><span style="color: rgb(0, 153, 153);" class="">10<br class=""></span><span style="color: rgb(0, 153, 153);" class=""> </span><span style="color: rgb(148, 85, 141);" class="">self</span>.width <span style="font-weight: bold;" class="">= </span><span style="color: rgb(0, 153, 153);" class="">640<br class=""></span><span style="color: rgb(0, 153, 153);" class=""> </span><span style="color: rgb(148, 85, 141);" class="">self</span>.height <span style="font-weight: bold;" class="">= </span><span style="color: rgb(0, 153, 153);" class="">400<br class=""></span><span style="color: rgb(0, 153, 153);" class=""> </span><span style="color: rgb(148, 85, 141);" class="">self</span>.initUI()<br class=""><br class=""> <span style="font-weight: bold;" class="">def </span><span style="color: rgb(153, 0, 0); font-weight: bold;" class="">initUI</span>(<span style="color: rgb(148, 85, 141);" class="">self</span>)<span style="font-weight: bold;" class="">:<br class=""></span><span style="font-weight: bold;" class=""> </span><span style="color: rgb(148, 85, 141);" class="">self</span>.setWindowTitle(<span style="color: rgb(148, 85, 141);" class="">self</span>.title)<br class=""> <span style="color: rgb(148, 85, 141);" class="">self</span>.setGeometry(<span style="color: rgb(148, 85, 141);" class="">self</span>.left, <span style="color: rgb(148, 85, 141);" class="">self</span>.top, <span style="color: rgb(148, 85, 141);" class="">self</span>.width, <span style="color: rgb(148, 85, 141);" class="">self</span>.height)<br class=""><br class=""> mainMenu <span style="font-weight: bold;" class="">= </span><span style="color: rgb(148, 85, 141);" class="">self</span>.menuBar()<br class=""> fileMenu <span style="font-weight: bold;" class="">= </span>mainMenu.addMenu(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'File'</span>)<br class=""> <span style="color: rgb(128, 128, 128);" class="">editMenu </span><span style="font-weight: bold;" class="">= </span>mainMenu.addMenu(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Edit'</span>)<br class=""> <span style="color: rgb(128, 128, 128);" class="">viewMenu </span><span style="font-weight: bold;" class="">= </span>mainMenu.addMenu(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'View'</span>)<br class=""> <span style="color: rgb(128, 128, 128);" class="">searchMenu </span><span style="font-weight: bold;" class="">= </span>mainMenu.addMenu(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Search'</span>)<br class=""> <span style="color: rgb(128, 128, 128);" class="">toolsMenu </span><span style="font-weight: bold;" class="">= </span>mainMenu.addMenu(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Tools'</span>)<br class=""> <span style="color: rgb(128, 128, 128);" class="">helpMenu </span><span style="font-weight: bold;" class="">= </span>mainMenu.addMenu(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Help'</span>)<br class=""><br class=""> exitButton <span style="font-weight: bold;" class="">= </span>QAction(QIcon(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'exit24.png'</span>), <span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Exit'</span>, <span style="color: rgb(148, 85, 141);" class="">self</span>)<br class=""> exitButton.setShortcut(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Ctrl+Q'</span>)<br class=""> exitButton.setStatusTip(<span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'Exit application'</span>)<br class=""> exitButton.triggered.connect(<span style="color: rgb(148, 85, 141);" class="">self</span>.close)<br class=""> fileMenu.addAction(exitButton)<br class=""><br class=""> <span style="color: rgb(148, 85, 141);" class="">self</span>.show()<br class=""><br class=""><br class=""><span style="font-weight: bold;" class="">if </span>__name__ <span style="font-weight: bold;" class="">== </span><span style="color: rgb(0, 128, 128); font-weight: bold;" class="">'__main__'</span><span style="font-weight: bold;" class="">:<br class=""></span><span style="font-weight: bold;" class=""> </span>app <span style="font-weight: bold;" class="">= </span>QApplication(sys.argv)<br class=""> ex <span style="font-weight: bold;" class="">= </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 style="" class=""><hr tabindex="-1" style="display: inline-block; width: 2053.09375px;" class=""><div id="divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><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" style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">That is extremely odd.</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">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" style="margin-bottom: 20px; overflow: auto; width: 2085px; text-indent: 0px;" class=""><table id="LPContainer_14905558568320.2733705825302566" cellspacing="0" 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);" class=""><tbody class=""><tr valign="top" style="border-spacing: 0px;" class=""><td id="TextCell_14905558568330.06978902659263309" colspan="2" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;" class=""><div id="LPRemovePreviewContainer_14905558568330.8102605280591344" class=""></div><div id="LPTitle_14905558568330.24243086588784535" 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;" class=""><a id="LPUrlAnchor_14905558568330.8462167529740874" href="https://pythonspot.com/en/pyqt5/" target="_blank" style="text-decoration: none;" class="">PyQT5 – Python Tutorial</a></div><div id="LPMetadata_14905558568330.8864540214841465" 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;" class=""><a href="http://pythonspot.com/" class="">pythonspot.com</a></div><div id="LPDescription_14905558568340.6611972607316958" 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;" class="">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 style="margin-top: 0px; margin-bottom: 0px;" class=""></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" style="margin-bottom: 20px; overflow: auto; width: 2085px; text-indent: 0px;" class=""><table id="LPContainer_14905556915610.2512137335813833" cellspacing="0" 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);" class=""><tbody class=""><tr valign="top" style="border-spacing: 0px;" class=""><td id="ImageCell_14905556915620.45661880606089" colspan="1" style="width: 250px; display: table-cell; padding-right: 20px;" class=""><div id="LPImageContainer_14905556915620.3578158883545095" style="background-color: rgb(255, 255, 255); height: 250px; margin: auto; display: table; width: 250px;" class=""><a id="LPImageAnchor_14905556915620.7513514414735187" href="http://pastebin.com/RJ3gnrAT" target="_blank" style="display: table-cell; text-align: center;" class=""><img id="LPThumbnailImageID_14905556915620.18384012432091779" width="250" height="250" src="http://pastebin.com/i/facebook.png" style="display: inline-block; max-width: 250px; max-height: 250px; height: 250px; width: 250px; border-width: 0px; vertical-align: bottom;" class=""></a></div></td><td id="TextCell_14905556915630.7679616588952209" colspan="2" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;" class=""><div id="LPRemovePreviewContainer_14905556915630.8223285960389648" class=""></div><div id="LPTitle_14905556915630.5885875927716291" 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;" class=""><a id="LPUrlAnchor_14905556915630.5270177408890231" href="http://pastebin.com/RJ3gnrAT" target="_blank" style="text-decoration: none;" class="">Process: Python [9764] Path: /usr/local/Cellar/p - Pastebin.com</a></div><div id="LPMetadata_14905556915630.7741633743554606" 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;" class=""><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 style="" class=""><hr tabindex="-1" style="display: inline-block; width: 2043.296875px;" class=""><div id="divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><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=""></body></html>