[PyQt] All QGroupBoxs stretchables with a QStackWidget?
alteo_gange
romanocaldoni at free.fr
Fri Oct 26 20:35:46 BST 2007
Hi!
Why all QGroupBoxs are stretchables when i rise size window in file1.txt
without QStackWidget and not in file2.txt with QStackWidget?
How have all QGroupBoxs stretchables with QStackWidget?
--
alteo_gange
-------------- next part --------------
#!/usr/bin/python
# -*- coding: Utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Gui(QWidget):
def __init__(self):
QWidget.__init__(self)
vbox=QVBoxLayout(self)
group=QGroupBox("groupbox1")
hbox=QHBoxLayout(group)
hbox.addWidget(QLabel("label1"))
vbox.addWidget(group)
group=QGroupBox("groupbox2")
hbox=QHBoxLayout(group)
hbox.addWidget(QLabel("label2"))
vbox.addWidget(group)
group=QGroupBox("groupbox3")
hbox=QHBoxLayout(group)
hbox.addWidget(QLabel("label3"))
vbox.addWidget(group)
self.setLayout(vbox)
if __name__ == "__main__":
app = QApplication(sys.argv)
main = Gui()
main.show()
sys.exit(app.exec_())
-------------- next part --------------
#!/usr/bin/python
# -*- coding: Utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Gui(QWidget):
def __init__(self):
QWidget.__init__(self)
vbox=QVBoxLayout(self)
group=QGroupBox("groupbox1")
hbox=QHBoxLayout(group)
hbox.addWidget(QLabel("label1"))
vbox.addWidget(group)
stacked=QStackedWidget()
group=QGroupBox("groupbox2")
hbox=QHBoxLayout(group)
hbox.addWidget(QLabel("label2"))
stacked.addWidget(group)
group=QGroupBox("groupbox3")
hbox=QHBoxLayout(group)
hbox.addWidget(QLabel("label3"))
stacked.addWidget(group)
vbox.addWidget(stacked)
self.setLayout(vbox)
if __name__ == "__main__":
app = QApplication(sys.argv)
main = Gui()
main.show()
sys.exit(app.exec_())
More information about the PyQt
mailing list