Build your gui use pyqt5
source
install
Windows
Install anaconda
linux && mac
1#you should have python3 installed first
2#mac
3brew install python3
4#ubuntu
5apt install python3 # apt install python-is-python3 make python default version 3
6#fedora
7dnf install python3 # dnf install python-is-python3
8#using pip or pipenv, i prefer pipenv
9pipenv install pyqt5
You may want to install pyqt5-tools install the qt-designer pipenv install pyqt5-tools . This makes your dev easilier
qt-designer
Create your first ui
You can design you ui by dragging the components, and change attributes of your components Press ctrl-r review your design
Convert your ui file to python code
1pyuic5 -x main.ui -o ui/main_window.py
Run your code
1import sys
2
3from main_window import Ui_MainWindow
4from PyQt5.QtWidgets import QMainWindow,QApplication
5
6class MainWindow(QMainWindow):
7def __init__(self, parent=None) -> None:
8 super().__init__(parent)
9 self.ui = Ui_MainWindow()
10 self.ui.setupUi(self)
11
12def main():
13 app = QApplication(sys.argv)
14 window = MainWindow()
15 #you can set title
16 #window.setWindowTitle("hello world")
17 window.show()
18 #you can set icon
19 #app.setWindowIcon("icon.icon")
20 sys.exit(app.exec_())
21
22if __name__ == "__main__":
23 main()
pyqt is so awesome