zoukankan      html  css  js  c++  java
  • PyQt5--ToolBar

     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 QIcon
    10 
    11 class New_test(QMainWindow):
    12     def __init__(self):
    13         super().__init__()
    14         self.initUI()
    15         
    16     def initUI(self):
    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 = QApplication(sys.argv)
    30     ex = New_test()
    31     sys.exit(app.exec_())

  • 相关阅读:
    第八章 对象
    第七章 压缩列表
    第六章 整数集合
    Java中的Unsafe
    站在Java的角度看LinkedList
    Java内部类详解
    浅析Java中的final关键字
    ConcurrentHashMap
    阻塞队列
    线程池的使用和实现
  • 原文地址:https://www.cnblogs.com/aziji/p/9646108.html
Copyright © 2011-2022 走看看