I am newly using PyQt4 on Ubuntu. My problem is that pyuic4 generates code that subclasses object rather than the appropriate widget class, which in this case should be QDialog.
I can import PyQt4.Qt in the python interpreter without error, and I can run the .ui python script in code that dynamically loads it using uic.loadUiType("filename.ui").
I suspect I did something wrong when installing Qt, sip, and PyQt4, but I've gone over the various instructions and can't see where I might have gone wrong. Lots of googling hasn't turned up anyone with a similar problem, so I'm asking for help.
Has anyone seen this before, or know what's going on? I welcome suggestions as to how fix this.
This is not a problem. It is supposed to be like that.
You need to make another class and subclass from your generated class AND from QDialog
.
This is your generated class:
class Ui_Class1(object):
...
This is the second class:
class Class1(QtGui.QDialog, Ui_Class1):
...
Now you can make changes to Class1
and use it. Important: Since Ui_Class1(object)
is automatically generated you should not make any changes to this class. Make all your changes to Class1(QtGui.QDialog, Ui_Class1)
.