[PyKDE] Troubles using a function to load pixmap in designer forms

Aurélien Gâteau aurelien at dental-on-line.fr
Wed Apr 16 12:16:00 BST 2003


Hi list!

When you create a form with Designer, it's possible to use a function to load 
pixmaps in widgets. I wrote a PixmapLoader module which contains a "load()" 
function. This function takes a string as a parameter and returns a QPixmap, 
so it's a good candidate for a pixmap loading function.

My first trouble was that Designer does not allow dots in function names so I 
used the name "pixmapLoad". All that was needed was to add a line like this 
at the top of the file :

    from PixmapLoader import load as pixmapLoad


Second trouble is to add this line automatically: I can't find any way in 
Designer to specify some code to be added at the beginning of the generated 
file. My idea is to add a new parameter to pyuic. This parameter would be a 
file containing extra code to be added before the class definition. Looking 
at pyuic code it seems easy to do, but I would like to have your opinion on 
any simpler way to achieve what I want before starting to hack.

Regards,
  Aurélien




More information about the PyQt mailing list