当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QMenuBar方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QMenuBar方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QMenuBar方法的具体用法?Python QtWidgets.QMenuBar怎么用?Python QtWidgets.QMenuBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QMenuBar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, QHangupsConversationsList):
        QHangupsConversationsList.setObjectName("QHangupsConversationsList")
        QHangupsConversationsList.resize(250, 500)
        self.centralwidget = QtWidgets.QWidget(QHangupsConversationsList)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.conversationsListWidget = QtWidgets.QListWidget(self.centralwidget)
        self.conversationsListWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.conversationsListWidget.setObjectName("conversationsListWidget")
        self.verticalLayout.addWidget(self.conversationsListWidget)
        QHangupsConversationsList.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(QHangupsConversationsList)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 250, 27))
        self.menubar.setObjectName("menubar")
        QHangupsConversationsList.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(QHangupsConversationsList)
        self.statusbar.setObjectName("statusbar")
        QHangupsConversationsList.setStatusBar(self.statusbar)

        self.retranslateUi(QHangupsConversationsList)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversationsList) 
开发者ID:xmikos,项目名称:qhangups,代码行数:24,代码来源:ui_qhangupsconversationslist.py

示例2: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, QHangupsConversations):
        QHangupsConversations.setObjectName("QHangupsConversations")
        QHangupsConversations.resize(500, 350)
        self.centralwidget = QtWidgets.QWidget(QHangupsConversations)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.conversationsTabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.conversationsTabWidget.setElideMode(QtCore.Qt.ElideRight)
        self.conversationsTabWidget.setTabsClosable(True)
        self.conversationsTabWidget.setMovable(True)
        self.conversationsTabWidget.setObjectName("conversationsTabWidget")
        self.gridLayout.addWidget(self.conversationsTabWidget, 0, 0, 1, 1)
        QHangupsConversations.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(QHangupsConversations)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 27))
        self.menubar.setObjectName("menubar")
        QHangupsConversations.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(QHangupsConversations)
        self.statusbar.setObjectName("statusbar")
        QHangupsConversations.setStatusBar(self.statusbar)

        self.retranslateUi(QHangupsConversations)
        self.conversationsTabWidget.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(QHangupsConversations) 
开发者ID:xmikos,项目名称:qhangups,代码行数:27,代码来源:ui_qhangupsconversations.py

示例3: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 300)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 400, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionNew = QtWidgets.QAction(MainWindow)
        self.actionNew.setObjectName("actionNew")
        self.actionExit = QtWidgets.QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionExit)
        self.menubar.addAction(self.menuFile.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Third-Edition,代码行数:27,代码来源:Designer_First_UI_Exit.py

示例4: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 300)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 400, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionNew = QtWidgets.QAction(MainWindow)
        self.actionNew.setObjectName("actionNew")
        self.menuFile.addAction(self.actionNew)
        self.menubar.addAction(self.menuFile.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Third-Edition,代码行数:24,代码来源:Designer_First_UI.py

示例5: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1285, 688)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(830, 0, 421, 521))
        self.label.setObjectName("label")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(250, 520, 93, 28))
        self.pushButton.setObjectName("pushButton")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1285, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:Yeah-Kun,项目名称:python,代码行数:24,代码来源:Demo3py.py

示例6: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(480, 640)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(150, 120, 171, 61))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 480, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        self.pushButton.clicked.connect(self.button_clicked)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:xugaoxiang,项目名称:learningPyQt5,代码行数:25,代码来源:designer.py

示例7: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(507, 151)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(160, 20, 201, 71))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label.setFont(font)
        self.label.setObjectName("label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 507, 25))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:joselado,项目名称:quantum-honeycomp,代码行数:24,代码来源:interface.py

示例8: init

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def init(self):
		menu_bar = next(i for i in QtWidgets.qApp.allWidgets() if isinstance(i, QtWidgets.QMenuBar))
		self.menu = menu_bar.addMenu(PLUGNAME)
		self.menu.addAction("Connect to pwntools").triggered.connect(self.prepare_debug_ui)
		return idaapi.PLUGIN_KEEP 
开发者ID:anic,项目名称:ida2pwntools,代码行数:7,代码来源:ida2pwntools.py

示例9: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def __init__(self):
        super(MenuManager, self).__init__()

        self._window = get_window()
        self._menu = self._window.findChild(QtWidgets.QMenuBar)

        self._menus = {} 
开发者ID:tmr232,项目名称:Sark,代码行数:9,代码来源:qt.py

示例10: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 300)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(0, 0, 391, 241))
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.tabWidget.addTab(self.tab_2, "")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 400, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionNew = QtWidgets.QAction(MainWindow)
        self.actionNew.setObjectName("actionNew")
        self.actionExit = QtWidgets.QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionExit)
        self.menubar.addAction(self.menuFile.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Third-Edition,代码行数:36,代码来源:Designer_Second_UI.py

示例11: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(516, 374)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.textEdit.setGeometry(QtCore.QRect(0, 10, 521, 331))
        self.textEdit.setObjectName("textEdit")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 516, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionOpen = QtWidgets.QAction(MainWindow)
        self.actionOpen.setObjectName("actionOpen")
        self.actionSave = QtWidgets.QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.actionSave)
        self.menubar.addAction(self.menuFile.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:PacktPublishing,项目名称:Qt5-Python-GUI-Programming-Cookbook,代码行数:30,代码来源:demoFileDialog.py

示例12: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1279, 677)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(150, 80, 441, 331))
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget) # 生成相对应的对象
        self.pushButton.setGeometry(QtCore.QRect(310, 510, 171, 61))# 确定该对象的位置以及大小
        self.pushButton.setObjectName("pushButton")                 # 设置名字,加载对象
        self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(870, 530, 91, 19))
        self.checkBox.setObjectName("checkBox")
        self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QtCore.QRect(750, 90, 421, 321))
        self.textBrowser.setObjectName("textBrowser")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1279, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:Yeah-Kun,项目名称:python,代码行数:32,代码来源:select.py

示例13: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.widget = QtWidgets.QWidget(self.centralwidget)
        self.widget.setGeometry(QtCore.QRect(250, 190, 301, 81))
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label = QtWidgets.QLabel(self.widget)
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        self.pushButton = QtWidgets.QPushButton(self.widget)
        self.pushButton.setMinimumSize(QtCore.QSize(50, 50))
        self.pushButton.setMaximumSize(QtCore.QSize(121, 51))
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:xugaoxiang,项目名称:learningPyQt5,代码行数:32,代码来源:ui_mainwindow.py

示例14: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(429, 177)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.btnStart = QtWidgets.QPushButton(self.centralwidget)
        self.btnStart.setObjectName("btnStart")
        self.horizontalLayout.addWidget(self.btnStart)
        self.btnMakeExcel = QtWidgets.QPushButton(self.centralwidget)
        self.btnMakeExcel.setObjectName("btnMakeExcel")
        self.horizontalLayout.addWidget(self.btnMakeExcel)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.btnYupjong = QtWidgets.QPushButton(self.centralwidget)
        self.btnYupjong.setObjectName("btnYupjong")
        self.horizontalLayout_2.addWidget(self.btnYupjong)
        self.btnCondition = QtWidgets.QPushButton(self.centralwidget)
        self.btnCondition.setObjectName("btnCondition")
        self.horizontalLayout_2.addWidget(self.btnCondition)
        self.gridLayout.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.btnJango = QtWidgets.QPushButton(self.centralwidget)
        self.btnJango.setObjectName("btnJango")
        self.horizontalLayout_3.addWidget(self.btnJango)
        self.btnChegyeol = QtWidgets.QPushButton(self.centralwidget)
        self.btnChegyeol.setObjectName("btnChegyeol")
        self.horizontalLayout_3.addWidget(self.btnChegyeol)
        self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.lineCmd = QtWidgets.QLineEdit(self.centralwidget)
        self.lineCmd.setObjectName("lineCmd")
        self.horizontalLayout_4.addWidget(self.lineCmd)
        self.btnRun = QtWidgets.QPushButton(self.centralwidget)
        self.btnRun.setObjectName("btnRun")
        self.horizontalLayout_4.addWidget(self.btnRun)
        self.gridLayout.addLayout(self.horizontalLayout_4, 3, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 429, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:coreanq,项目名称:kw_condition,代码行数:56,代码来源:mainwindow_ui.py

示例15: configureMenu

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QMenuBar [as 别名]
def configureMenu(self):
        # Create menuBar
        # see:  http://doc.qt.io/qt-4.8/qmenubar.html
        # see:  http://zetcode.com/gui/PyQt5/menusandtoolbars/
        # see:  https://pythonprogramming.net/menubar-pyqt-tutorial/
        # see:  http://www.dreamincode.net/forums/topic/261282-a-basic-pyqt-tutorial-notepad/
        mainMenu = QtWidgets.QMenuBar()
        # mainMenu.setNativeMenuBar(False)

        fileMenu = mainMenu.addMenu('&File')

        saveSummaryAction = QtWidgets.QAction("Save Summary", self.mainWindow)
        saveSummaryAction.triggered.connect(self.saveSummary)
        fileMenu.addAction(saveSummaryAction)

        loadSummaryAction = QtWidgets.QAction("Load Summary", self.mainWindow)
        loadSummaryAction.triggered.connect(self.loadSummary)
        fileMenu.addAction(loadSummaryAction)

        quitAction = QtWidgets.QAction("&Quit", self.mainWindow)
        quitAction.setShortcut("Ctrl+Q")
        quitAction.triggered.connect(self.closeApplication)
        fileMenu.addAction(quitAction)

        viewMenu = mainMenu.addMenu('View')

        showConsoleAction = QtWidgets.QAction("Show Python Console", self)
        showConsoleAction.triggered.connect(self.console.show)
        viewMenu.addAction(showConsoleAction)

        showLogsAction = QtWidgets.QAction("Show Logs", self)
        showLogsAction.triggered.connect(self.loggingDialog.show)
        viewMenu.addAction(showLogsAction)

        optionsMenu = mainMenu.addMenu('Options')

        showPreferencesAction = QtWidgets.QAction("Preferences", self)
        showPreferencesAction.triggered.connect(self.preferencesDialog.exec_)
        optionsMenu.addAction(showPreferencesAction)

        helpMenu = mainMenu.addMenu('Help')

        aboutPyweedAction = QtWidgets.QAction("&About PYWEED", self)
        aboutPyweedAction.triggered.connect(self.showAboutDialog)
        helpMenu.addAction(aboutPyweedAction)
        helpMenu.addSeparator()

        self.mainWindow.setMenuBar(mainMenu)
        # self.waveformsDialog.setMenuBar(mainMenu) 
开发者ID:iris-edu,项目名称:pyweed,代码行数:51,代码来源:PyWeedGUI.py


注:本文中的PyQt5.QtWidgets.QMenuBar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。