Sep-19-2017, 09:19 PM
I'm learning Python through a YouTube channel that offers many tutorials in Computer Science and especially programming.
The tutorial I was watching is about creating a menu and have the Exit button in the 'File' menu. I copied the code from his video ran it but it shows an empty window with size 320x240 and not showing anything else.
Here is the code that he had in his YouTube tutorial:
The tutorial I was watching is about creating a menu and have the Exit button in the 'File' menu. I copied the code from his video ran it but it shows an empty window with size 320x240 and not showing anything else.
Here is the code that he had in his YouTube tutorial:
import sys from PyQt4.QtGui import * a = QApplication(sys.argv) w = QMainWindow() w.resize(320, 240) w.setWindowTitle("Hello World!") mainMenu = w.menuBar() fileMenu = mainMenu.addMenu('&File') exitButton = QAction('Exit', w) exitButton.setShortcut('Ctrl+Q') exitButton.setStatusTip('Exit Application') exitButton.triggered.connect(w.close) fileMenu.addAction(exitButton) w.show() sys.exit(a.exec_())Would anyone explain to me why this is not working or supply me with any sites/articles/videos etc.?