[PyQt] com.apple.xbs Error-- Please help- Thank you

David Cortesi davecortesi at gmail.com
Mon Mar 27 17:11:55 BST 2017


> I got all of these scripts from tutorials so they should work.
>

When they don't, you should perhaps communicate with the tutorial authors?

I ran the code you gave under Wing IDE and it runs and opens a main window
of the specified size. However it displays only an Application menu with a
standard Quit entry that reads "Quit Python". No File, or other, menus, and
(somewhat to my surprise) no Edit menu.

    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')
>
>
Although these create QMenu objects and assign them to the QMenuBar, the
menus contain no QActions and as a result they do not appear.

When I added one line,

        editMenu = mainMenu.addMenu('Edit')
        editMenu.addAction( 'bleargh' )

then the Edit menu appeared, with one action "bleargh" followed by a menu
divider and two (apparently gratuitous) additions by MacOS, Start Dictation
and Emoji&Symbols.

When I added a similar empty action to another menu, then that menu
appeared in the menu bar. So, at least in Mac OS, you have to add at least
one action to a menu for it to appear at all.

This would appear to be a shortcoming in the tutorial.

The following code has no effect. I presume this is because in MacOS, the
Quit action is preempted by the Python interpreter -- as the application
menu ends with "Quit Python" regardless of whether I run the script from
the IDE or from the command line with "python grant.py".

        exitButton = QAction(QIcon('exit24.png'), 'Exit', self)
>         exitButton.setShortcut('Ctrl+Q')
>         exitButton.setStatusTip('Exit application')
>         exitButton.triggered.connect(self.close)
>         fileMenu.addAction(exitButton)


I heard some of these issues will be fixed in May with the release of PyQt
> 5.9?
>

There is nothing going in in this example that hasn't been current since
Qt4. This is very basic stuff and i don't think there are any "issues" to
address. If you find tkinter easier to work with, and it does what you need
done, by all means use it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170327/927693ec/attachment.html>


More information about the PyQt mailing list