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 很 ...
随机推荐
- pyqt lineedit右边显示按钮效果
from PyQt4 import QtGui, QtCore class ButtonLineEdit(QtGui.QLineEdit): buttonClicked = QtCore.pyqtSi ...
- Android学习总结——强制下线功能(广播)
最近一口气买了好几本书,其中Android的<第一行代码>觉得真心不错,学到这个内容,顺便做个总结,加深印象. 强制下线的基本思想就是在界面上弹出一个对话框,让用户必须点击确定按钮跳转到登 ...
- VCS仿真生成vpd文件(verilog)
VCS仿真生成vpd文件(verilog) 一.环境与文件 Linux平台 csh环境 VCS 64bit 代码文件请参考<一个简单的Verilog计数器模型> 二.开始仿真 1.com ...
- "客户端无法连接到远程计算机"错误的解决方法
问题: 客户端无法连接到远程计算机. 可能没有启用远程连接或者计算机太忙不能接受新的连接. 也可能是网络问题阻止连接.请稍后重新尝试连接. 如果问题仍然存在 请与管理员联系. 解决方法: 1.首先确认 ...
- Bootstrap新手常见问题
题记 bootstrap这个开源的UI库确实很方便,用了两日,觉得不错,但也有些问题比较头疼! 主题 1.怎么使用?怎么定制?下面是一个范例,修改了navbar的颜色,重新设置了select控件的默认 ...
- hadoop配置文件的加载机制
hadoop通过Configuration类来保存配置信息 1.通过Configuration.addResource()来加载配置文件 2.通过Configuration.get***()来获取配置 ...
- [转]hibernate主键生成策略
1.自动增长identity 适用于MySQL.DB2.MS SQL Server,采用数据库生成的主键,用于为long.short.int类型生成唯一标识使用SQL Server 和 MySQL 的 ...
- js中constructor的作用
在学习过程中对js的constructor的作用产生了疑问.下面是学习的资料进行梳理 function Person(area){ this.type = 'person'; this.area = ...
- 关于JS中的this关键字
在学习js时,应该先了解下this关键字,关于js中的this关键字和其他的面向对象语言中的this是不同的,比如在java中,this指的的是当前对象,而在js中,w3c是这样规定的: 关键字 th ...
- 逃离迷宫(HDU 1728 BFS)
逃离迷宫 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...