[PyQt] Re: how to show interactive Picture

David Boddie david at boddie.org.uk
Tue Feb 10 23:53:32 GMT 2009

On Wed, 11 Feb 2009 00:24:47 +0100, Markus Feldmann wrote:

> > Here's what might be causing the image not to appear. If, for some
> > reason, the basicdrawing_rc.py file was created without the image data,
> > this will fail, leaving you with a null pixmap.

> I understand, but my Programm does not have any resource files. And it
> appears correctly, why?

Actually, I don't know. How do you load the image in your program?

> Is it because of my special solution ?

Which is this, I guess:

  self.image = QImage("./media/images/aventurien.jpg")

This will work, but be aware that you are using a relative path to specify
the file. What happens if you try to run the program from a different

> So when do i need the resource file and what is the advantage of
> the resource file?
> How can i create <basicdrawing_rc.py> file?(qmake)

Just use the pyrcc4 tool at the command line:

  pyrcc4 -o basicdrawing_rc.py basicdrawing.qrc

This creates the basicdrawing_rc.py file (the -o option tells pyrcc4 to
write to this file).

It's not necessary to understand how to use resources initially, but you
will find them useful when you start wanting to run the program from within
different directories.


More information about the PyQt mailing list