1. Create a new PyCharm Python project (set up the Python interpreter)
2. Create entering QtDesigner Designer (how to add QtDesigner https://www.cnblogs.com/nxopen2018/p/12502514.html )
3. Set the interface (adding controls)
4. Save interface
5. pyuic .py file to be converted into ui ( how adding pyuic https://www.cnblogs.com/nxopen2018/p/12502514.html )
6. Establish the main function .py file, add code to call ui dialog
Import SYS Import MainWin # Import associated module from PyQt5.QtWidgets Import QApplication, the QWidget, The QMainWindow IF the __name__ == ' __main__ ' : # Create QApplication object represents the entire application App = QApplication (the sys.argv) # Create a main window mainWindow = QMainWindow () # call the classes and methods ui file, and add to the main window controls ui = MainWin.Ui_MainWindow () ui.setupUi (mainWindow) # show ui mainWindow.show () # to enter the main loop of the program, and through the exit The main loop function to ensure the safe end sys.exit(app.exec_())
7. Run
Caesar Lu Shangyu
2020 March 16