当前位置: 首页 > >

pyqt5中菜单栏和工具栏在qt_designer中设计

发布时间:

p


y


q


t


5





























q


t


?


d


e


s


i


g


n


e


r












pyqt5中菜单栏和工具栏在qt-designer中设计


pyqt5中菜单栏和工具栏在qt?designer中设计
一 新建主窗口







添加信号和槽函数





太麻烦了,还是用手动添加

from PyQt5.Qt import *
import sys
import os
import pydicom

from resources.main_window_ui import Ui_MainWindow


class MyMainWindow(QMainWindow, Ui_MainWindow):

def __init__(self, parent=None):
super(MyMainWindow, self).__init__(parent)
self.setupUi(self)
self.open_file.triggered.connect(self.call_back_action_open_file)
self.open_dir.triggered.connect(self.call_back_action_store_dir)

def call_back_action_open_file(self):
print("call_back_action_open_file")

def call_back_action_store_dir(self):
print("call_back_action_store_dir")



if __name__ == "__main__":
app = QApplication(sys.argv)
myWin = MyMainWindow()
myWin.show()
sys.exit(app.exec_())




友情链接: