欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pyqt4 menu bar

程序员文章站 2024-02-24 13:35:40
...
        exit = QtGui.QAction(QtGui.QIcon(':/log.ico'), 'Exit', self)
        exit.setShortcut('Ctrl+Q')
        exit.setStatusTip('Exit Application')
        self.connect(exit, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()'))

        help = QtGui.QAction(QtGui.QIcon(':/log.ico'), 'Help', self)
        help.setShortcut('Ctrl+Q')

        menu_bar = self.menuBar()
        file1 = menu_bar.addMenu('&File')

        file1.addAction(exit)
        file1.addAction(help)