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_())
  • 相关阅读:
    提升ASP.NET性能
    人性的弱点
    墨菲定律
    沟通
    网站
    程序员思维模式
    CSS
    HTML
    路由和数据传递(04)
    Sql Server中查看所有数据库,表名,字段名以及字段类型
  • 原文地址:https://www.cnblogs.com/fuqia/p/8711077.html
Copyright © 2011-2022 走看看