pyqt QTreeWidget例子学习
# -*- coding: utf-8 -*-
# python:2.x
__author__ = 'Administrator'
from PyQt4.QtGui import *
from PyQt4.Qt import *
from PyQt4.QtCore import *
import sys
class Tree(QMainWindow):
def __init__(self,parnet=None):
super(Tree,self).__init__(parnet)
self.setWindowTitle('TreeWidget')
self.tree = QTreeWidget()
self.tree.setColumnCount(2)
self.tree.setHeaderLabels(['Key','Value'])
root= QTreeWidgetItem(self.tree)
root.setText(0,'root')
child1 = QTreeWidgetItem(root)
child1.setText(0,'child1')
child1.setText(1,'name1')
child2 = QTreeWidgetItem(root)
child2.setText(0,'child2')
child2.setText(1,'name2')
child3 = QTreeWidgetItem(root)
child3.setText(0,'child3')
child4 = QTreeWidgetItem(child3)
child4.setText(0,'child4')
child4.setText(1,'name4')
self.tree.addTopLevelItem(root)
self.setCentralWidget(self.tree)
app =QApplication(sys.argv)
x = Tree()
x.show()
sys.exit(app.exec_())
如图:
注:由网友提供的内容,地址:http://blog.sina.com.cn/s/blog_4b5039210100h6co.html
pyqt QTreeWidget例子学习的更多相关文章
- pyqt columnView例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt QTableView例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt QTableWidget例子学习(重点)
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...
- pyqt 托盘例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...
- pyqt 正则表达式例子学习
def rex01(self): username=QtCore.QRegExp('[a-zA-Z0-9_]{2,10}') self.names.setValidator(QtGui.QRegExp ...
- pyqt tabWidget例子学习1
from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT impor ...
- pyqt 配置文件例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys,datetime from PyQt4.QtC ...
- pyqt 自定义例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys from PyQt4.QtCore impor ...
- 数百个 HTML5 例子学习 HT 图形组件 – 3D建模篇
http://www.hightopo.com/demo/pipeline/index.html <数百个 HTML5 例子学习 HT 图形组件 – WebGL 3D 篇>里提到 HT 很 ...
随机推荐
- VSCode
下载: 打开终端控制器 wget http://download.microsoft.com/download/0/D/5/0D57186C-834B-463A-AECB-BC55A8E466AE/V ...
- 推荐C/C++常见的面试题目
http://blog.163.com/bingqingyujie..5/blog/static/75559361201011861958534/ 里面有详细的面试类型
- 使用Qt Style Sheets制作UI特效
引言 作为一套GUI框架,Qt是非常强大的.(注:Qt 不仅是一套优秀的GUI框架,同时也是一套出色的应用程序框架).在UI的制作方面Qt为广大开发者提供了一套强大而易用的工具,她就是——Qt Sty ...
- JavaScript 字符串函数 之查找字符方法(一)
1.JavaScript查找字符方法 首先看一张 有关字符串函数的查找字符的方法图 接下里补充里面的方法说明 2.charAt() charAt() 方法返回字符串中指定位置的字符 语法 ...
- javascript系统时间
<div> <%--系统时间--%> 当前时间是: <script type=& ...
- http断点续传原理
断点续传一是断点,一续传. 断点是在下载时,将下载文件分多片,同时进行多片一起下载,如果任务被暂停,暂停的位置就是断点. 续传就是未完成的下载再次开始时,会从上次的断点继续传送. 在下载(或上传)过程 ...
- SQL Server Profile:使用方法和指标说明
SQL Server Profiler的中文意思是SQL Server事件探查,一个Sql的监视工具,可以具体到每一行Sql语句,每一次操作,和每一次的连接.感觉这个工具的作用还是很大的,给大家分享一 ...
- iOS的触摸事件
在iOS中不是任何对象都能处理事件,只有继承了UIResponder的对象才能接收并处理事件,我们称其为@''响应者对象''UIApplication,UIViewController,UIView都 ...
- 浅谈Windows Server APPFABRIC
hi,everyone !真的是好久好久没有update blog了,因为最近忙着备考,没有时间对<数据结构与算法>进行研究学习了.所以,blog一直未更新.today is Friday ...
- JS生成不重复随机数
说明 我们可以用Math.random()的方法轻松的生成 一个随机的数字,但是这个数字可能是重复的.有时候,我们需要一个不重复的随机数,可以用很多的方法来实现这个要求,以下方法是效率最高的. 解释 ...