I have to replace the wxNotebook control with a PySide equivalent. Which widget/approach in PySide shall I use best?
Asked
Active
Viewed 148 times
0
-
If it helps in any way, the wxNotebook is a container that holds multiple panels as tabs. – user2963623 Aug 11 '14 at 20:19
-
@user2963623 Thanks, does it mean if I use pyside, I can use WidgetTab to get the same output? – EricBkc Aug 13 '14 at 20:19
-
I am not familiar with pyqt4/pyside widgets, but seeing the examples on internet, I think so. – user2963623 Aug 13 '14 at 22:05
1 Answers
1
Here's an example of a tab widget in pyside/ pyqt4 which is similar to a notebook in 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()
Courtesy of This

user2963623
- 2,267
- 1
- 14
- 25