PyQt5--ToolBar

2019-09-25 20:36栏目:网络编程
TAG:

 1 # -*- coding:utf-8 -*- 2 ''' 3 Created on Sep 14, 2018 4  5 @author: SaShuangYiBing 6 ''' 7 import sys 8 from PyQt5.QtWidgets import QApplication,QMainWindow,QAction,qApp 9 from PyQt5.QtGui import QIcon10 11 class New_test(QMainWindow):12     def __init__:13         super().__init__()14         self.initUI()15         16     def initUI:17         exitAction = QAction(QIcon('tools.png'),'Exit',self)18         exitAction.setShortcut('Ctrl+Q')  #注意该组合快捷键需要连着写,不能有空格,否则会导致快捷键失效19         exitAction.triggered.connect(qApp.quit)20         21         self.toolbar = self.addToolBar('Exit')22         self.toolbar.addAction(exitAction)23         24         self.setGeometry(300,300,250,150)25         self.setWindowTitle('Tools Bar')26         self.show()27         28 if __name__ == "__main__":29     app = QApplication30     ex = New_test()31     sys.exit(app.exec_

图片 1

版权声明:本文由澳门新葡亰平台游戏发布于网络编程,转载请注明出处:PyQt5--ToolBar

    随机看看

    NEW ARTICLE

    热门文章

    HOT ARTICLE