Table of contents
3. Develop at the line of code
0x00 Preface:
The preferred use of QtDesigner tools:
1. His interface development is the main function we need to use
2. The use of other functions can be used if necessary (it would be better for other functions to write custom codes by ourselves)
1. Complete the basic layout
According to your own needs, complete the layout of the interface
Advantages: The layout speed of the interface is faster than typing the code directly
2. Use of other functions
Use QtDesigner to control signal starting point logic events
As can be seen from the options below, the logical events that can be triggered are all basic (triggers that cannot be customized)
Disadvantages: So other functions of QtDesigner (signal binding logic operation) are not suitable for us to write custom projects
3. Develop at the line of code
First load the ui in py
import sys
from PyQt5 import uic
from PyQt5.QtWidgets import *
class MyWindow(QWidget):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.ui = uic.loadUi("./my_win.ui")
if __name__ == '__main__':
app = QApplication(sys.argv)
w = MyWindow()
w.ui.show() # 展示窗口
sys.exit(app.exec_())