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 很 ...
随机推荐
- qt动态更新界面的菜鸟代码,请指出
qt简单界面更新代码(菜鸟级)(部分代码) self.timers_1=QtCore.QTimer(self) self.timers_1.timeout.connect(self.min_1) se ...
- 自定义jquery插件
参考:http://blog.csdn.net/bao19901210/article/details/21540137/ 自己看代码理解: <!DOCTYPE html> <htm ...
- Spark Accumulators
概述 Accumulator即累加器,与Mapreduce counter的应用场景差不多,都能很好地观察task在运行期间的数据变化,Spark中的Accumulator各task可以对Accumu ...
- vmplayer中的fedora20无法进入图形界面
新装了台fedora20的虚拟机,安装升级了一些东西后.启动时过了fedora的logo画面后就是黑屏. 也没提示不论什么错误,好在shell还能进去.查看/var/log/anaconda/sysl ...
- mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法
权限问题,授权 给 root 全部sql 权限 mysql> grant all privileges on *.* to root@"%" identified by & ...
- 图像重采样(CPU和GPU)
1 前言 之前在写影像融合算法的时候,免不了要实现将多光谱影像重采样到全色大小.当时为了不影响融合算法整体开发进度,其中重采样功能用的是GDAL开源库中的Warp接口实现的. 后来发现GDAL War ...
- 静态方法中不能new内部类的实体对象
原因如下: 1.内部类可以访问外部类的成员变量 2.对象创建完成后对象的成员变量才会被分配空间 3.main的静态方法执行时可以不存在外部类,不创建实体对象 4.内部类能访问成员变量意味着一定存在外部 ...
- OWIN启动项的检测
OWIN启动项的检测 通过以下方法设置启动项: 命名约定 Katana在命名空间内查找StartUp类 OwinStartup Attribute [assembly: OwinStartup(typ ...
- 1、shell 简介
Shell 本身是一个用C语言编写的程序,它是用户使用Unix/Linux的桥 梁,用户的大部分工作都是通过Shell完成的.Shell既是一种命令语言,又是一种程序设计语言.作为命令语言,它交互式地 ...
- Tomcat unable to start
在学习springMvc时,导入springfreemarker 的jar包,写好web.xml,config.xml 后. 部署到tomcat,异常如下: 八月 27, 2016 5:44:41 下 ...