Problem with Qt

Discussion in 'Python' started by Michael McGarry, Dec 12, 2004.

  1. 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
    Michael McGarry, Dec 12, 2004
    #1
    1. Advertising

  2. 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
    Diez B. Roggisch, Dec 13, 2004
    #2
    1. Advertising

  3. Thanks, I had just discovered Qt Designer. I will probably use this. It
    seems to work well.

    Michael
    Michael McGarry, Dec 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,950
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,136
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    1,943
    Merek
    Dec 3, 2003
  4. Scott Meddows
    Replies:
    1
    Views:
    379
    John Saunders
    Jun 8, 2004
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    532
    Bullschmidt
    May 11, 2004
Loading...

Share This Page