[PyQt] com.apple.xbs Error-- Please help- Thank you
Barry Scott
barry at barrys-emacs.org
Mon Mar 27 08:48:03 BST 2017
> On 26 Mar 2017, at 22:18, Grant Fraser <grantrf93 at hotmail.com> wrote:
>
> Nice, I am going to download Barry's Emacs right now.
>
> The IDE may be getting in the way.
> Why is it working in the terminal but without all the menu buttons?
> There should be "file" "view" "search" "tools" "help" items in the top menu bar as well.
I think it is because you need to add actions to all the menus you added for them to appear.
Barry
>
> I really meant to post this code (my apologies):
>
> import sys
> from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QPushButton, QAction
> from PyQt5.QtGui import QIcon
> from PyQt5.QtCore import pyqtSlot
>
>
> class App(QMainWindow):
> def __init__(self):
> super().__init__()
> self.title = 'PyQt5 menu - pythonspot.com <http://pythonspot.com/>'
> self.left = 10
> self.top = 10
> self.width = 640
> self.height = 400
> self.initUI()
>
> def initUI(self):
> self.setWindowTitle(self.title)
> self.setGeometry(self.left, self.top, self.width, self.height)
>
> mainMenu = self.menuBar()
> fileMenu = mainMenu.addMenu('File')
> editMenu = mainMenu.addMenu('Edit')
> viewMenu = mainMenu.addMenu('View')
> searchMenu = mainMenu.addMenu('Search')
> toolsMenu = mainMenu.addMenu('Tools')
> helpMenu = mainMenu.addMenu('Help')
>
> exitButton = QAction(QIcon('exit24.png'), 'Exit', self)
> exitButton.setShortcut('Ctrl+Q')
> exitButton.setStatusTip('Exit application')
> exitButton.triggered.connect(self.close)
> fileMenu.addAction(exitButton)
>
> self.show()
>
>
> if __name__ == '__main__':
> app = QApplication(sys.argv)
> ex = App()
> sys.exit(app.exec_())
> 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.
>
> Thanks a bunch Barry.
>
> Sincerely,
> Grant
> From: Barry <barry at barrys-emacs.org>
> Sent: Sunday, March 26, 2017 4:00 PM
> To: Grant Fraser
> Cc: pyqt at riverbankcomputing.com
> Subject: Re: [PyQt] com.apple.xbs Error-- Please help- Thank you
>
> I don't use an IDE.
>
> I use Barry's Emacs and the editor and a terminal shell to ru the code.
>
> It seems the IDE is getting in your way.
>
> The menus are exactly as expected on macOS as I remarked.
>
> Barry
>
>
> On 26 Mar 2017, at 20:26, Grant Fraser <grantrf93 at hotmail.com <mailto:grantrf93 at hotmail.com>> wrote:
>
>> That is extremely odd.
>>
>> Site with tutorials: https://pythonspot.com/en/pyqt5/ <https://pythonspot.com/en/pyqt5/>
>> Menu code that causes error for me https://pythonspot.com/en/pyqt5-menu/ <https://pythonspot.com/en/pyqt5-menu/>
>> PyQT5 – Python Tutorial <https://pythonspot.com/en/pyqt5/>
>> pythonspot.com <http://pythonspot.com/>
>> 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.
>> I am on a Mac 10.12.3
>> Python 3.6
>>
>> 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.
>> Screenshots attached.
>>
>> How many menu bar items do you receive ?
>> No view, tools, search, or help menu bar items, like the program seems to supposedly create.
>>
>> I do not know why I am not receiving all of the menu bar items.
>>
>> In PyCharm the full error I receive is http://pastebin.com/RJ3gnrAT <http://pastebin.com/RJ3gnrAT>
>> <http://pastebin.com/RJ3gnrAT>
>> Process: Python [9764] Path: /usr/local/Cellar/p - Pastebin.com <http://pastebin.com/RJ3gnrAT>
>> pastebin.com <http://pastebin.com/>
>> Additionally have you tried running this program in one of your IDEs without errors?
>>
>> Thanks a bunch,
>>
>> Grant
>>
>> From: Barry Scott <barry at barrys-emacs.org <mailto:barry at barrys-emacs.org>>
>> Sent: Sunday, March 26, 2017 7:41 AM
>> To: Grant Fraser
>> Cc: pyqt at riverbankcomputing.com <mailto:pyqt at riverbankcomputing.com>
>> Subject: Re: [PyQt] com.apple.xbs Error-- Please help- Thank you
>>
>>
>>> On 25 Mar 2017, at 17:25, Grant Fraser <grantrf93 at hotmail.com <mailto:grantrf93 at hotmail.com>> wrote:
>>>
>>> Mac OS Python 3 PyQt5
>>> Program that causes error from tutorial but 'works' for the site owner (http://zetcode.com/gui/pyqt5/menustoolbars/ <http://zetcode.com/gui/pyqt5/menustoolbars/>):
>>
>> I ran the code in your email and it works error free.
>>
>> macOs 10.12.3
>> python 3.5.2 and 3.6.0 with PyQt5 5.7 and 5.8.1
>>
>> What versions are you using?
>>
>> I put your code into file a.py and run it from the command line as:
>>
>> $ python3.6 a.py
>>
>> Note: that this example bumps into macOS specific handling of menus.
>>
>> 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.
>>
>> Barry
>>
>>>
>>> Menus and toolbars in PyQt5 - ZetCode <http://zetcode.com/gui/pyqt5/menustoolbars/>
>>> zetcode.com <http://zetcode.com/>
>>> 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.
>>>
>>> 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_())
>>> Error:
>>> 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'
>>> *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.
>>> *I have even checked hidden folders.
>>> *Perhaps you could try running it yourself and seeing if you get the same error. I would really appreciate any help. Thank you.
>>>
>>> _______________________________________________
>>> PyQt mailing list PyQt at riverbankcomputing.com <mailto:PyQt at riverbankcomputing.com>
>>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt <https://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>> <Screen Shot 2017-03-26 at 2.22.23 PM.png>
>> <Screen Shot 2017-03-26 at 2.22.15 PM.png>
>> <Screen Shot 2017-03-26 at 2.21.47 PM.png>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170327/50686a24/attachment-0001.html>
More information about the PyQt
mailing list