PyQt5--ToolBar

 # -*- coding:utf-8 -*-
'''
Created on Sep 14, 2018 @author: SaShuangYiBing
'''
import sys
from PyQt5.QtWidgets import QApplication,QMainWindow,QAction,qApp
from PyQt5.QtGui import QIcon class New_test(QMainWindow):
def __init__(self):
super().__init__()
self.initUI() def initUI(self):
exitAction = QAction(QIcon('tools.png'),'Exit',self)
exitAction.setShortcut('Ctrl+Q') #注意该组合快捷键需要连着写,不能有空格,否则会导致快捷键失效
exitAction.triggered.connect(qApp.quit) self.toolbar = self.addToolBar('Exit')
self.toolbar.addAction(exitAction) self.setGeometry(300,300,250,150)
self.setWindowTitle('Tools Bar')
self.show() if __name__ == "__main__":
app = QApplication(sys.argv)
ex = New_test()
sys.exit(app.exec_())

PyQt5--ToolBar

上一篇:yum自动安装mysql


下一篇:Bzoj3122:多项式BSGS