PySide中的哪个小部件类似于wxwidgets中的wxNotebook控件?

时间:2014-08-11 14:17:19

标签: wxpython pyside wxnotebook

我必须用PySide等效替换wxNotebook控件。我最好使用PySide中的哪个小部件/方法?

1 个答案:

答案 0 :(得分:1)

以下是pyside / pyqt4中的标签小部件示例,类似于wxwidgets中的笔记本:

from PyQt4 import QtGui
from PyQt4 import QtCore
import sys

def main():

    app     = QtGui.QApplication(sys.argv)
    tabs    = QtGui.QTabWidget()
    pushButton1 = QtGui.QPushButton("QPushButton 1")
    pushButton2 = QtGui.QPushButton("QPushButton 2")

    tab1    = QtGui.QWidget()   
    tab2    = QtGui.QWidget()
    tab3    = QtGui.QWidget()

    vBoxlayout  = QtGui.QVBoxLayout()
    vBoxlayout.addWidget(pushButton1)
    vBoxlayout.addWidget(pushButton2)

    #Resize width and height
    tabs.resize(250, 150)

    #Move QTabWidget to x:300,y:300
    tabs.move(300, 300)

    #Set Layout for Third Tab Page
    tab3.setLayout(vBoxlayout)   

    tabs.addTab(tab1,"Tab 1")
    tabs.addTab(tab2,"Tab 2")
    tabs.addTab(tab3,"Tab 3")

    tabs.setWindowTitle('PyQt QTabWidget Add Tabs and Widgets Inside Tab')
    tabs.show()

    sys.exit(app.exec_())


if __name__ == '__main__':
    main()

This提供