Fwd: [PyQt] Subclass pyuic4 generated file...

simozack simozack at yahoo.it
Fri Jan 16 19:47:13 GMT 2009


I forward this message to the list, because I send this only in
private. Sorry for the error.

Simone
---------- Forwarded message ----------
From: simozack <simozack at yahoo.it>
Date: 2009/1/16
Subject: Re: [PyQt] Subclass pyuic4 generated file...
To: NoursBleu <noursbleu at free.fr>


2009/1/16 NoursBleu <noursbleu at free.fr>:

> class Ui_ImageDialog(object):
>    def setupUi(self, ImageDialog):

[skip]

> import sys
> from PyQt4 import QtCore, QtGui
> from Ui_test import Ui_ImageDialog
>
> class ImageDialog(QtGui.QDialog):
>    def __init__(self):
>        QtGui.QDialog.__init__(self)
>        self.ui = Ui_ImageDialog()
>        self.ui.setupUi(self)
>
>        #Modifications
>        self.ui.pushButton.setText("MyNewText")

Try this:

class ImageDialog(QtGui.QDialog, Ui_ImageDialog):
  def __init__(self, parent = None):
      QtGui.QDialog.__init__(self, parent)
      self.setupUi(self)

      self.pushButton.setText("MyNewText")

This version is, IMHO, simpler and easier to manage.

HTH,
Simone


More information about the PyQt mailing list