2

I have an application written with pyside where a user can load an image, via either drag&drop or through a dialog box, and the image name and a thumbnail will show up in a QTreeWidget. When I run normally (within Eclipse) everything works fine. When I package the project with py2exe it no longer displays the image. I assume it is because py2exe is not finding the image libraries used by pyside. I do not know enough about pyside and py2exe to know if this is the actual issue. After doing some searches I found a lot of information on people not able to display images that are apart of the application (icons) which I have already resolved (Edit - These were png files which is why they showed up after I bundled the images in the py2exe step).

I am using QPixMap to load the thumbnail image into a QIcon. I then add the icon to a QTreeWidgetItem.

icon = QIcon()
icon.addPixmap(QPixmap(url),QIcon.Normal,QIcon.Off)
item = QTreeWidgetItem([...])
item.setIcon(0,icon)
PatTheGamer
  • 471
  • 4
  • 17

1 Answers1

1

Im assuming you are using probably a jpeg and not png. Png will work natively but jpeg requires an image plugin to be properly packaged into your exe

Enabling JPEG support for QImage in py2exe-compiled Python scripts?

Community
  • 1
  • 1
jdi
  • 90,542
  • 19
  • 167
  • 203
  • Also, on Qt wiki: [Packaging PySide applications on Windows](http://developer.qt.nokia.com/wiki/Packaging_PySide_applications_on_Windows) – reclosedev Jan 22 '12 at 05:27
  • This did it. I think the reason I did not see it before was because this was for pyqt and not specifically pyside. Glad that it works for both. Thanks! – PatTheGamer Jan 22 '12 at 19:43
  • PySide and PyQt are both built against Qt. Pretty much all the information is applicable between them. – jdi Jan 22 '12 at 21:46
  • Right I was just trying to figure out why it did not come up in the search. :) – PatTheGamer Jan 26 '12 at 05:24