pyqt5 hello world gui

Solutions on MaxInterview for pyqt5 hello world gui by the best coders in the world

showing results for - "pyqt5 hello world gui"
Aitana
09 Aug 2019
1import sys
2from PyQt5.QtCore import *
3from PyQt5.QtGui import *
4from PyQt5.QtWidgets import *
5class window(QWidget):
6   def __init__(self, parent = None):
7      super(window, self).__init__(parent)
8      self.resize(200,50)
9      self.setWindowTitle("PyQt5")
10      self.label = QLabel(self)
11      self.label.setText("Hello World")
12      font = QFont()
13      font.setFamily("Arial")
14      font.setPointSize(16)
15      self.label.setFont(font)
16      self.label.move(50,20)
17def main():
18   app = QApplication(sys.argv)
19   ex = window()
20   ex.show()
21   sys.exit(app.exec_())
22if __name__ == '__main__':
23   main()