Statusbar、Menubar、Toolbar合集
In the last example of this section, we create a menubar, a toolbar and a statusbar. We also create a central widget.
#!/usr/bin/python
# -*- coding: utf-8 -*- """
ZetCode PyQt4 tutorial This program creates a skeleton of
a classic GUI application with a menubar,
toolbar, statusbar and a central widget. author: Jan Bodnar
website: zetcode.com
last edited: September 2011
""" import sys
from PyQt4 import QtGui class Example(QtGui.QMainWindow): def __init__(self):
super(Example, self).__init__() self.initUI() def initUI(self): textEdit = QtGui.QTextEdit()
self.setCentralWidget(textEdit) exitAction = QtGui.QAction(QtGui.QIcon('exit24.png'), 'Exit', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip('Exit application')
exitAction.triggered.connect(self.close) self.statusBar() menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(exitAction) toolbar = self.addToolBar('Exit')
toolbar.addAction(exitAction) self.setGeometry(300, 300, 350, 250)
self.setWindowTitle('Main window')
self.show() def main(): app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_()) if __name__ == '__main__':
main()
This code example creates a skeleton of a classic GUI application with a menubar, toolbar, and a statusbar.
textEdit = QtGui.QTextEdit()
self.setCentralWidget(textEdit)
Here we create a text edit widget. We set it to be the central widget of the QtGui.QMainWindow
. The central widget occupies all space that is left.
Figure: MainWindow
Statusbar、Menubar、Toolbar合集的更多相关文章
- 掘金 Android 文章精选合集
掘金 Android 文章精选合集 掘金官方 关注 2017.07.10 16:42* 字数 175276 阅读 50053评论 13喜欢 669 用两张图告诉你,为什么你的 App 会卡顿? - A ...
- 最新最全的 Android 开源项目合集
原文链接:https://github.com/opendigg/awesome-github-android-ui 在 Github 上做了一个很新的 Android 开发相关开源项目汇总,涉及到 ...
- SQL Server技术内幕笔记合集
SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...
- 【Android】开发中个人遇到和使用过的值得分享的资源合集
Android-Classical-OpenSource Android开发中 个人遇到和使用过的值得分享的资源合集 Trinea的OpenProject 强烈推荐的Android 开源项目分类汇总, ...
- [Erlang 0122] Erlang Resources 2014年1月~6月资讯合集
虽然忙,有些事还是要抽时间做; Erlang Resources 小站 2014年1月~6月资讯合集,方便检索. 小站地址: http://site.douban.com/204209/ ...
- [Erlang 0114] Erlang Resources 小站 2013年7月~12月资讯合集
Erlang Resources 小站 2013年7月~12月资讯合集,方便检索. 附 2013上半年盘点: Erlang Resources 小站 2013年1月~6月资讯合集 小站地 ...
- SQL用法操作合集
SQL用法操作合集 一.表的创建 1.创建表 格式: 1 CREATE TABLE 表名 2 (列名 数据类型(宽度)[DEFAULT 表达式][COLUMN CONSTRAINT], 3 ... ...
- Python学习路径及练手项目合集
Python学习路径及练手项目合集 https://zhuanlan.zhihu.com/p/23561159
- Lucene搜索方式大合集
package junit; import java.io.File; import java.io.IOException; import java.text.ParseException; imp ...
随机推荐
- [BZOJ2402]陶陶的难题II(树链剖分+线段树维护凸包+分数规划)
陶陶的难题II 时间限制:40s 空间限制:128MB 题目描述 输入格式 第一行包含一个正整数N,表示树中结点的个数. 第二行包含N个正实数,第i个数表示xi (1<=xi<= ...
- [BZOJ3583]杰杰的女性朋友(矩阵快速幂)
杰杰的女性朋友 时间限制:10s 空间限制:256MB 题目描述 杰杰是魔法界的一名传奇人物.他对魔法具有深刻的洞察力,惊人的领悟力,以及令人叹为观止的创造力.自从他从事魔法竞赛以来,短短几 ...
- 20162325 金立清 S2 W8 C17
20162325 2017-2018-2 <程序设计与数据结构>第8周学习总结 教材学习内容概要 二叉查找树是一棵二叉树,对于其中的每个结点,左子树上的元素小于父结点的值,而右子树上的元素 ...
- Java解释执行和编译执行
以前有句话说:“Java是解释执行的 ” .现在看来确实不是很准确,至于原因,在此简略解释: 首先,我们先解释一下在Java中解释执行和编译执行的区别. 解释执行:将编译好的字节码一行一行地翻译为机器 ...
- bzoj 3932: [CQOI2015]任务查询系统 -- 主席树 / 暴力
3932: [CQOI2015]任务查询系统 Time Limit: 20 Sec Memory Limit: 512 MB Description 最近实验室正在为其管理的超级计算机编制一套任务管 ...
- Swift 笔记1
// Playground - noun: a place where people can play import Cocoa var str = "Hello, playground&q ...
- 一个iframe注入漏洞,也是微软的 Application["error"] 漏洞
最近学校进行安全等级评估,有人给我打电话,说我之前写的一个网站存在iframe注入漏洞,页面是error页面.我于是用netsparker扫描了自己的网站,果然发现error页面存在漏洞,我写网站的时 ...
- 数组、Set对象的互相转换
一.数组与Set对象之间的转换可以实现数组的去重(数组可重复,Set不可重复) 1. 把数组对象转换为Set对象 var arr = [1,2,3,4,5,6,7,6,6,7]; console.lo ...
- MatLab角点检測(harris经典程序)
http://blog.csdn.net/makenothing/article/details/12884331 这是源博客的出处,鄙人转过来是为了更好的保存!供大家一起学习!已将原始的博客的文章的 ...
- [转]对Why Scrum will never work的评论
近来,Maurits的一篇博文“Why Scrum will never work” 一石激起千层浪.著名技术分享网站酷壳(http://coolshell.cn/articles/5044.html ...