[PyQt] Centering inside groupbox... newbie question
Mark Rages
markrages at gmail.com
Thu Nov 29 18:50:16 GMT 2007
Hi,
I'm new to PyQt and Qt in general.
I want to make a QGroupBox containing a centered QLabel. The QLabel
needs to remain centered as the groupbox is resized.
It is easy to make a QLabel that stays centered:
#!/usr/bin/python2.4
import sys
import qt
a = qt.QApplication(sys.argv)
textlabel=qt.QLabel("textlabel",None)
textlabel.setAlignment(qt.QLabel.AlignCenter)
a.setMainWidget(textlabel)
textlabel.show()
a.exec_loop()
# end program
But I can't seem to get the same behaviour inside the groupbox:
#!/usr/bin/python2.4
import sys
import qt
a = qt.QApplication(sys.argv)
gb = qt.QHGroupBox("gblabel",None)
textlabel=qt.QLabel("textlabel",gb)
textlabel.setAlignment(qt.QLabel.AlignCenter)
a.setMainWidget(gb)
gb.show()
a.exec_loop()
#end program
The label stays contered horizontally, but hugs the top of the groupbox.
What am I missing?
Regards,
Mark
markrages at gmail
--
Mark Rages, Engineer
Midwest Telecine LLC
markrages at midwesttelecine.com
More information about the PyQt
mailing list