zoukankan      html  css  js  c++  java
  • 工具栏

    效果如下:

    代码如下:

     1 #!/usr/bin/python3
     2 # -*- coding: utf-8 -*-
     3 
     4 """
     5 This program creates a toolbar.
     6 The toolbar has one action, which
     7 terminates the application, if triggered.
     8 
     9 """
    10 
    11 import sys
    12 from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
    13 from PyQt5.QtGui import QIcon
    14 
    15 
    16 class Example(QMainWindow):
    17 
    18     def __init__(self):
    19         super().__init__()
    20 
    21         self.initUI()
    22 
    23     def initUI(self):
    24 
    25         exitAct = QAction(QIcon('picturesexit24.png'), 'Exit', self)
    26         exitAct.setShortcut('Ctrl+Q')
    27         exitAct.triggered.connect(qApp.quit)
    28 
    29         self.toolbar = self.addToolBar('Exit')
    30         self.toolbar.addAction(exitAct)
    31 
    32         self.setGeometry(300, 300, 300, 200)
    33         self.setWindowTitle('Toolbar')
    34         self.show()
    35 
    36 
    37 if __name__ == '__main__':
    38 
    39     app = QApplication(sys.argv)
    40     ex = Example()
    41     sys.exit(app.exec_())
  • 相关阅读:
    造数据
    自定义注解
    利用线程池,同步线程实现并发
    ThreadPoolExecutor 线程池
    velocity 模板
    [python] 解析xml文件
    url 中需要转义的字符
    Appium 坑
    TestNG 101
    【python】print · sys.stdout · sys.stderr
  • 原文地址:https://www.cnblogs.com/fuqia/p/8711077.html
Copyright © 2011-2022 走看看