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