By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,518 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,518 IT Pros & Developers. It's quick & easy.

Problem with Qt

P: n/a
Hi,

I am trying to show a radio button group on a window, but only the last
radio button shows up. Anyone know why?

Here is the code:

from qt import *
import sys
a = QApplication(sys.argv)
widget = QWidget()
trafftype = QButtonGroup("Traffic Type", widget)
poisson = QRadioButton("Poisson", trafftype)
selfsimilar = QRadioButton("Self-Similar", trafftype)
a.setMainWidget(widget)
widget.show()
a.exec_loop()

Any help is greatly appreciated.

Michael
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I think you have to introduce a layout on the group. The best thing is to
use qdesigner, it will do that for you. If you really need code, this is
cut'n'paste from a generate py-file:

self.buttonGroup4 = QButtonGroup(self,"buttonGroup4")
self.buttonGroup4.setColumnLayout(0,Qt.Vertical)
self.buttonGroup4.layout().setSpacing(6)
self.buttonGroup4.layout().setMargin(11)
buttonGroup4Layout = QHBoxLayout(self.buttonGroup4.layout())
buttonGroup4Layout.setAlignment(Qt.AlignTop)

self.radioButton3 = QRadioButton(self.buttonGroup4,"radioButton3")
buttonGroup4Layout.addWidget(self.radioButton3)
self.radioButton3_2 = QRadioButton(self.buttonGroup4,"radioButton3_2")
buttonGroup4Layout.addWidget(self.radioButton3_2)

--
Regards,

Diez B. Roggisch
Jul 18 '05 #2

P: n/a
Thanks, I had just discovered Qt Designer. I will probably use this. It
seems to work well.

Michael
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.