pyqt Error with qtdesigner button groups

G

Gelonida

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top