pyqt标签例子学习

import sys

from PyQt4 import QtGui

def main():

app=QtGui.QApplication(sys.argv)

window=QtGui.QWidget()

window.setWindowTitle(u‘标签‘)

tab1=QtGui.QScrollArea()

tab_layout=QtGui.QVBoxLayout(tab1)

test1=QtGui.QTextBrowser()

tab_layout.addWidget(test1)

tab2 = QtGui.QScrollArea()

tab2_layout = QtGui.QVBoxLayout(tab2)

tab3=QtGui.QPushButton(u‘按钮‘)

tab2_layout.addWidget(tab3)

tab_widget =QtGui.QTabWidget()

tab_widget .addTab(tab1,u‘标签1‘)

tab_widget .addTab(tab2,u‘标签2‘)

main_layout =QtGui.QVBoxLayout()

main_layout.addWidget(tab_widget)

main_layout .addStretch(1)

window.setLayout(main_layout)

window.show()

sys.exit(app.exec_())

main()

结果如下:

时间: 2024-10-03 23:10:02

pyqt标签例子学习的相关文章

pyqt QTableWidget例子学习(重点)

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4.QtCore import * lista = ['aa', 'ab', 'ac'] listb = ['ba', 'bb', 'bc'] listc = ['ca', 'cb', 'cc'] mystruct = {'A':lista, 'B':

pyqt 正则表达式例子学习

def rex01(self): username=QtCore.QRegExp('[a-zA-Z0-9_]{2,10}') self.names.setValidator(QtGui.QRegExpValidator(username,self)) mainname=QtCore.QRegExp("^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$") self.mains.setValidator(QtGui.QRegExpValidator(mainnam

pyqt columnView例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from PyQt4.Qt import * from PyQt4.QtCore import * import sys class Tree(QColumnView): def __init__(self,parnet=None,*args): super(Tree,self).__init__(parnet,

pyqt 托盘例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4.QtCore import * from tp import Ui_Form import sys from PyQt4.QtCore import Qt QTextCodec.setCodecForTr(QTextCodec.codecForNa

pyqt tabWidget例子学习1

from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT import sys class myTabWidget(QtGui.QTabWidget): def tabChangedSlot(self,argTabIndex): QtGui.QMessageBox.information(self,"Tab Index Changed!", "C

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.

pyqt 配置文件例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys,datetime from PyQt4.QtCore import Qt from PyQt4 import QtGui,QtCore,Qt from aa import Ui_Form class Example(QtGui.QDialog,Ui_Form): def __init__(self,parnet=None): super(Exa

pyqt 自定义例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys from PyQt4.QtCore import Qt from PyQt4 import QtGui,QtCore,Qt from about import Ui_Form class Example(QtGui.QDialog,Ui_Form): def __init__(self,parnet=None): super(Example, 

pyqt QTableView例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from PyQt4.Qt import * from PyQt4.QtCore import * import sys class Tree(QTableView): def __init__(self,parnet=None,*args): super(Tree,self).__init__(parnet,*