[PyQt] PyQT/Qt Designer question

Tim Finkbeiner timf at cableone.net
Sat May 17 07:57:31 BST 2008


Hi
I'm pretty new to development with PyQt, and I have a couple of
questions. I've followed a simple tutorial to create a basic
application, but I've run into a snag regarding the toolbar icons.
The code that pyuic generated for my main frame looks like this:

...
    self.fileNewAction = QAction(self,"fileNewAction")

self.fileNewAction.setIconSet(QIconSet(QPixmap.fromMimeSource("filenew.png")))
    self.fileOpenAction = QAction(self,"fileOpenAction")

self.fileOpenAction.setIconSet(QIconSet(QPixmap.fromMimeSource("fileopen.png")))
    self.fileSaveAction = QAction(self,"fileSaveAction")

self.fileSaveAction.setIconSet(QIconSet(QPixmap.fromMimeSource("filesave.png")))
...

The problem I have is that all of these images are in a folder
called /images. If I modify this generated code, adding the path to the
image file name, I can get these images to show up, but the next time I
run pyuic, these modifications are overwritten.

I haven't been able to find a way to tell either QT Designer nor pyuic
where these images are located. What is the proper way to do this. I
usually run pyuic from a bash script, and I've considered adding code to
create symlinks to each of the images in the images folder, but that
seems like  a brute force solution. I also tried setting the sys.path in
my derived class' constructor to include './images' but this didn't seem
to work. Is there a "proper" technique to solve this problem?

Thanks in advance!
Tim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080517/f771ccf3/attachment.html


More information about the PyQt mailing list