
本文共 4429 字,大约阅读时间需要 14 分钟。
##Qt���������������������������������������������������������������
���������Qt Designer��������������������������������������������������������������������������������������������� Womensual���������������������������������������������������������������������������������������������������������������������������������������
###1. ���berger������������
������������������������������������������������������������������������������������������������������������������������������������
-
������������QMenu������������������������������QMenu������������������������������������������������QAction���������������QAction������������QMenu���������������triggered��������������������������������������������� Designer���������������������������������������QMenu���QAction������������������������������������triggered���������
-
������������Qmenu���QAction���������������������������������������������������������������������������������������������������������������������������������
###2. ������������������
������������QToolBar������������������������������������������������������������������������������������������������������������������������������������������������Add Tool Bar���������"������������������������������������������������������������������������������������triggered���������
- ������������QToolBar������������������������������������������������������������������������Action���������������������������
###3. ������������������
������������������������������������������������������������������������������������������������������������������������QStatusBar���������������������������������������������getter���������������������
###4. ������Designer������������
������������������������������������������������������������������������������
������Designer.exe���������������������Main Window���������Create������������������������������������Main Window������������������������������������������������������������������
������������������������������������
-
���������������������������������������������������������������Action������������������Action������������������������������������������
-
���������������������Action������������������������������������������������
-
���������������������������������������Action���������������������������������������������������
���������������������������������������������OK���������
###5. ���UI���������������Python������
���������������������������������������������������������UI���������������Python������������������������������������������*.ui���������������Python���������
pyuic5 -o ui_action_tool.py action_tool.ui
###6. ������Python������
������PyQt5������������Python������������������������������UI���������������������������������������������Python���������������
import sysfrom PyQt5.QtWidgets import (qw, Ui_MainWindow)import ui_action_tooldef __init__(self): super().__init__() self.setupUi(self) self.statusbar.showMessage("���������������") self.action_start.triggered.connect(self.handle_start) self.action_pause.triggered.connect(self.handle_pause) self.action_exit.triggered.connect(self.handle_stop) self.action_clear.triggered.connect(self.handle_clear)def handle_start(self): # ��������������������������������������������� qw.QMessageBox.information(self, "������", "������������Start������")def handle_pause(self): # ������������������������������������������ qw.QMessageBox.information(self, "������", "������������Pause������")def handle_stop(self): # ������������������������������������������ qw.QMessageBox.information(self, "������", "������������Stop������")def handle_clear(self): # ������������������������������������������ qw.QMessageBox.information(self, "������", "������������Clear������")if __name__ == "__main__": app = qw.QApplication(sys.argv) w = myForm() w.show() app.exec_()
###7. ������������
������������������������������Python���������
python3 run.py
������������������������������������������MainWindow���������������������������������������������
###8. ������������������
���������������������������������������������������������������������������������������������
self.statusbar.showMessage("��������� bolsu olu dwellisor")
������������������������������������������������������������
������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
