[第19期]Write a PyQt calculator program by using MVC architecture/使用MVC架構寫一個PyQt計算機程式
This video demonstrate how to write a PyQt calculator program by using MVC architecture.
The content includes: 1. MVC Architecture Introduction 2. Place codes with different purposes into Model.py, View.py and Controller.py PS: calculator.py please refer to video No. 18. 本視頻說明如何使用MVC架構寫一個PyQt計算機程式, 內容包含: 1. MVC架構簡介 2. 將不同意義的程式碼分別寫在Model.py, View.py以及Controller.py中。 註: calculator.py請參考第18期視頻PyQt Template模板
import sys from PyQt5 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() |
留言