[PyKDE] Re: pyuic

Jorge Luiz Godoy Filho godoy at ieee.org
Thu Feb 24 10:44:37 GMT 2005

Darren Robert Haagman wrote:

> I've been messing around with Python/QT/KDevelop which of course,
> converts a .ui to a .py file.
> Is there any work being done to _not_ erase the code in the .py file
> when redesigning the form?
> I find it rather frustrating when I make a small change in the .ui and
> then have to rewrite all of my python code for that module.
> OR
> Is there a way to inherit from the generated .py file in such a way that
> I can put my code in another derived class and still use the component
> events in that derived class?

Am I understanding it correctly and you're editing the files with the note:

# WARNING! All changes made in this file will be lost!


You should really subclass it and then work on the subclass.  It is just a
matter of where you send events to and which slots you have implemented.

You can also create Python code directly with Designer -- I've read that and
I didn't use this, yet... -- and end up with the specific code for the
interface on the same file.

But you shouldn't change the file by hand as the warning says.

In fact, I *like* that pyuic erases the file.  It forces you to separate
code from the UI from the rest of the code.  It also makes it easy to reuse
code with other kinds of interface without loosing the ability to work with

Godoy.    <godoy at ieee.org>

More information about the PyQt mailing list