前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >PyQt5--MenuBar

PyQt5--MenuBar

作者头像
py3study
发布2020-01-19 17:08:13
3520
发布2020-01-19 17:08:13
举报
文章被收录于专栏:python3python3python3
 1 # -*- coding:utf-8 -*-
 2 '''
 3 Created on Sep 13, 2018
 4 
 5 @author: SaShuangYiBing
 6 '''
 7 import sys
 8 from PyQt5.QtWidgets import QApplication,QMainWindow,QAction,qApp
 9 from PyQt5.Qt 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('exit.png'),'&Exit',self)
18         exitAction.setShortcut('Ctrl + D')
19         exitAction.setStatusTip('Exit Application')
20         exitAction.triggered.connect(qApp.quit)
21         
22         self.statusBar()
23         
24         menubar = self.menuBar()
25         fileMenu = menubar.addMenu('&File')
26         fileMenu.addAction(exitAction)
27         
28         self.setGeometry(300,300,250,150)
29         self.setWindowTitle('Menubar')
30         self.show()
31         
32 if __name__ == "__main__":
33     app = QApplication(sys.argv)
34     ex = New_test()
35     sys.exit(app.exec_())
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-03-10 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档