<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I got all of these scripts from tutorials so they should work.<br></blockquote><div><br></div><div>When they don't, you should perhaps communicate with the tutorial authors?<br><br></div><div>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.<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    def initUI(self):<br></blockquote></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
        self.setWindowTitle(self.<wbr>title)<br>
        self.setGeometry(self.left, self.top, self.width, self.height)<br>
<br>
        mainMenu = self.menuBar()<br>
        fileMenu = mainMenu.addMenu('File')<br>
        editMenu = mainMenu.addMenu('Edit')<br>
        viewMenu = mainMenu.addMenu('View')<br>
        searchMenu = mainMenu.addMenu('Search')<br>
        toolsMenu = mainMenu.addMenu('Tools')<br>
        helpMenu = mainMenu.addMenu('Help')<br>
<br></blockquote><div><br></div><div>Although these create QMenu objects and assign them to the QMenuBar, the menus contain no QActions and as a result they do not appear.<br><br></div><div>When I added one line,<br><br></div><div>        editMenu = mainMenu.addMenu('Edit')<br></div><div>        editMenu.addAction( 'bleargh' )<br><br></div><div>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.<br><br></div><div>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.<br><br></div><div>This would appear to be a shortcoming in the tutorial.<br><br></div><div>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".<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
        exitButton = QAction(QIcon('exit24.png'), 'Exit', self)<br>
        exitButton.setShortcut('Ctrl+<wbr>Q')<br>
        exitButton.setStatusTip('Exit application')<br>
        exitButton.triggered.connect(<wbr>self.close)<br>
        fileMenu.addAction(exitButton)</blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I heard some of these issues will be fixed in May with the release of PyQt 5.9?<br></blockquote><div><br></div><div>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.<br></div></div></div></div>