[PyKDE] Designer

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Thu May 20 10:05:01 BST 2004


On Wednesday 19 May 2004 20:50, Mark Saward wrote:
> Hi,
>
> I'm just starting to learn python and PyQt at the same time.  

Good choice.

> I'm making
> an application using designer.  The problem is, that every time I use
> 'pyuic' I'm finding I need to modify the resulting file every time.
> Right now I need to add a member function:
>
>     def keyPressEvent(self, event):
>         if event.text() == 'd':
>             player.Player.x +=1
>
> Is there a way I can write that member function in another file and have
> it easily accessed by the resulting file from pyuic without needing to
> re-add much code every time?

Create a new file containing a new class, with the pyuic-generated class as a 
base class. Add your method to this new class.

To use it, create instances of the new class. Dont directly create instances 
of the pyuic-generated class.

I hope that helps.

-- 
Toby Dickenson




More information about the PyQt mailing list