[第18期]Use PyQt and Qt Designer to implement GUI of Calculator/使用PyQt與Qt Designer製作計算機圖形介面
This video introduce how to use PyQt and Qt Designer to implement GUI of Calculator.
Including:
1. Use Qt Designer to design User Interface
2. Load UI file
3. Connect “Signal”and “Slot”
- Use Signal/Slot Editor in Qt Designer中
- Use connect() Method to connect Signal and Slot
4. Make a calculator with Button, LineEdit and Label
本視頻介紹如何使用PyQt與Qt Designer製作計算機圖形介面,內容包含:
1. 使用Qt Designer設計介面
2. 在PyQt中載入UI檔
3. 連接"信號"與"槽"
- 在Qt Designer中使用Signal/Slot Editor
- 在程式中使用connect()方法連結Signal和Slot
4. 使用按鈕、文字輸入與標籤來製作計算機
(2022/10/13) Updated Video/更新的視頻
PyQt Template模板
import sys from PyQ t5 import QtWidgets, uic | |
class MainWindow(QtWidgets.QMainWindow): | |
def __init__(self, *args, **kwargs): | |
super(MainWindow, self).__init__(*args, **kwargs) | |
#Load the UI Page by PyQt5 | |
uic.loadUi("ui name.ui", self) | |
self.setWindowTitle("ui title") | |
def main(): | |
app = QtWidgets.QApplication(sys.argv) | |
main = MainWindow() | |
main.show() | |
sys.exit(app.exec()) | |
if __name__ == '__main__': | |
main() |
留言