[PyQt] New member (Drag and Drop)

David Boddie david at boddie.org.uk
Thu Mar 8 22:39:29 GMT 2012


On Thu Mar 8 15:59:20 GMT 2012, Shoemaker, Ronnie A wrote:

> Okay, I will narrow the scope of this question for now.
>
> I am playing with the draggablewidgets demo in PyQt4. What is the secret to
> getting different images into that app or how do I create a PNG image that
> it will load?

First, make sure that the images can be loaded by PyQt4 by trying to load
them into the imageviewer.py example.

If that works, modify the draggableicons.qrc file to refer to your new
images and run the pyrcc4 tool to create a draggableicons_rc.py file.
The pyrcc4 tool basically converts the image data into a textual format that
can be stored in that Python module.

The example imports the module, causing the images to be registered as
resources - the ':/images/boat.png' string you can see in the
draggableicons.py example is a reference to the image in a kind of resource
file system. You need to update these strings to refer to your images.

Good luck!

David


More information about the PyQt mailing list