Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problem with Qt

Reply
Thread Tools

Problem with Qt

 
 
Michael McGarry
Guest
Posts: n/a
 
      12-12-2004
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
 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      12-13-2004
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
 
Reply With Quote
 
 
 
 
Michael McGarry
Guest
Posts: n/a
 
      12-13-2004
Thanks, I had just discovered Qt Designer. I will probably use this. It
seems to work well.

Michael
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments