[PyQt] Subclass pyuic4 generated file...

NoursBleu noursbleu at free.fr
Sat Jan 17 22:09:25 GMT 2009


On Friday 16 January 2009 20:47:13 simozack wrote:
> 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.
>

Thanx, this is simpler, but still not working...
self.pushButton.setText("MyNewText") doesn't modify pushButton text.

All commands put after #Modifications have no effect, so I can't modify any 
widgets in the dialog. Maybe the way dialog is shown ??
Have an idea ?




More information about the PyQt mailing list