pyqt Error with qtdesigner button groups

Discussion in 'Python' started by Gelonida, Jul 25, 2010.

  1. Gelonida

    Gelonida Guest

    Hi,

    I have have a layout with qt designer, which contains radio buttons.

    Now I want to add three buttons into a button group.

    doing this manually works fine

    with manually I mean adding a few lines in my widget class.
    example:
    bg = self.buttongroup = Qg.QButtonGroup()
    bg.addButton(self.radioButton, 1)
    bg.addButton(self.radioButton_2, 2)
    bg.addButton(self.radioButton_3, 3)

    When I try to create a button group from qt designer, then python code
    is created which fails when running:

    How I create a button group with qtdesigner.

    - I select my three radio buttons
    - I right click in the object inspector and select
    "Assign to Button Group" -> "New Button Group"

    I create my python file with
    pyuic4 -o mywidget.py -x mywidget.ui

    When I try to use my widget I receive follwoing error:

    Traceback (most recent call last):
    .. . .
    line 37
    self.QtGui.QApplication.translate("FormGridState", "buttonGroup",
    None, QtGui.QApplication.UnicodeUTF8) = QtGui.QButtonGroup(FormGridState)
    SyntaxError: can't assign to function call

    The generated code lines for the buttongroup look like:
    self.QtGui.QApplication.translate("Form1", "buttonGroup", None,
    QtGui.QApplication.UnicodeUTF8) = QtGui.QButtonGroup(Form1)
    self.QtGui.QApplication.translate("Form1", "buttonGroup", None,
    QtGui.QApplication.UnicodeUTF8).setObjectName("QtGui.QApplication.translate(\"Form1\",
    \"buttonGroup\", None, QtGui.QApplication.UnicodeUTF8)")
    self.QtGui.QApplication.translate("Form1", "buttonGroup", None,
    QtGui.QApplication.UnicodeUTF8).addButton(self.radioButton)


    Am I doing something wrong or is this a bug?

    I'm running ubuntu 10.4 , and python 2.6
    Gelonida, Jul 25, 2010
    #1
    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. Christopher Grinde

    pyuic for qtdesigner 3.3

    Christopher Grinde, Apr 30, 2004, in forum: Python
    Replies:
    2
    Views:
    476
    David Boddie
    Apr 30, 2004
  2. Siraj Kutlusan

    Qtdesigner and python

    Siraj Kutlusan, Dec 27, 2005, in forum: Python
    Replies:
    2
    Views:
    662
  3. bbmerong
    Replies:
    0
    Views:
    262
    bbmerong
    May 26, 2008
  4. Nigel Wilkinson

    Using qtruby with qtdesigner query

    Nigel Wilkinson, Nov 9, 2006, in forum: Ruby
    Replies:
    2
    Views:
    110
    Nigel Wilkinson
    Nov 9, 2006
  5. David Brunell
    Replies:
    7
    Views:
    164
    Stefano Crocco
    Jan 21, 2009
Loading...

Share This Page