PySide/Qt : .ico files not shown

207 views
Skip to first unread message

nio

unread,
Mar 17, 2012, 1:41:51 AM3/17/12
to pyins...@googlegroups.com
Hello,

My basic application based on Python 2.7.2+PySide+Qt on win7 is using some .ico files to create a toolbar.

The icons don't appear when running the executable created with PyInstaller (I tried the onfile and the onedir options), even if I'm manually copying them locally.

Can somebody help me solve this basic issue ?

Thanks!

Nicolas.

Adrià Cereto Massagué

unread,
Mar 18, 2012, 8:26:39 AM3/18/12
to pyins...@googlegroups.com
Maybe you're missing a Qt plugin which gives support for .ico files. I've never used .ico files for icons, but I know that this happens too for .svg and .jpg files.
You must include the necessary Qt plugins. An alternative way is to use .png files, which are more portable and your final executable will be smaller, as you will need fewer dll files included.



--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pyinstaller/-/IZXv7dzmFyIJ.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.



--
Adrià Cereto Massagué
Ph.D Student
Nutrigenomics Research Group
Biochemistry and Biotechnology Department
Building N4, Campus Sescelades
Universitat Rovira i Virgili
Tarragona, Catalonia

Languages: Català, Español, English, Français, Deutsch, Português

Nota importante | Important Notice

nio

unread,
Mar 20, 2012, 12:54:37 PM3/20/12
to pyins...@googlegroups.com
Hello,

Thanks for your answer, but I don't understand at which level a Qt plugin would be missing ?
Where and how should I include a Qt plugin ? Is it inside my python script ?
Or should I explicitely declare a given Qt plugin to PyInstaller if it didn't detect it as a dependancy ?

My script is using basic functions involving icon files like:
self.setWindowIcon(QtGui.QIcon('calendar.ico'))
or
refreshAction = QtGui.QAction(QtGui.QIcon('refresh_icon.ico'), 'Refresh', self)

I can use png or another format, but I undestand that the problem will be the same.

I've tried to include all Qt .dll files inside my generated executable's directory but it didn't help...

Thanks for your help.

Nicolas.



On Sunday, March 18, 2012 1:26:39 PM UTC+1, Adrià Cereto Massagué wrote:
Maybe you're missing a Qt plugin which gives support for .ico files. I've never used .ico files for icons, but I know that this happens too for .svg and .jpg files.
You must include the necessary Qt plugins. An alternative way is to use .png files, which are more portable and your final executable will be smaller, as you will need fewer dll files included.


El 17 de març de 2012 6:41, nio <lordn...@gmail.com> ha escrit:
Hello,

My basic application based on Python 2.7.2+PySide+Qt on win7 is using some .ico files to create a toolbar.

The icons don't appear when running the executable created with PyInstaller (I tried the onfile and the onedir options), even if I'm manually copying them locally.

Can somebody help me solve this basic issue ?

Thanks!

Nicolas.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pyinstaller/-/IZXv7dzmFyIJ.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.

Martin Zibricky

unread,
Mar 20, 2012, 1:33:48 PM3/20/12
to pyins...@googlegroups.com
Hi nicolas,

PySide is not officially supported yet. Two users forked pyinstaller on
github to work on pyside support. For details see

http://www.pyinstaller.org/ticket/498

nio píše v Út 20. 03. 2012 v 09:54 -0700:

Adrià Cereto Massagué

unread,
Mar 20, 2012, 2:58:21 PM3/20/12
to pyins...@googlegroups.com
El 20 de març de 2012 17:54, nio <lordn...@gmail.com> ha escrit:
Hello,

Thanks for your answer, but I don't understand at which level a Qt plugin would be missing ?
Where and how should I include a Qt plugin ? Is it inside my python script ?
Or should I explicitely declare a given Qt plugin to PyInstaller if it didn't detect it as a dependancy ?

My script is using basic functions involving icon files like:
self.setWindowIcon(QtGui.QIcon('calendar.ico'))
or
refreshAction = QtGui.QAction(QtGui.QIcon('refresh_icon.ico'), 'Refresh', self)

I can use png or another format, but I undestand that the problem will be the same.

That's the case with gif and svg icons, but png is a built-in image format, so you won't need any plugins for it.
 

I've tried to include all Qt .dll files inside my generated executable's directory but it didn't help...

You must play with QCoreApplication.addLibraryPath() and add a plugins directory containing the needed Qt plugins. Google around for how to do it for .svg or .gif icons, somewhere there's a recipe about how to do it.

Other possible approach is to build Qt statically, so that everything will be built-in, with nos eparate plugins.
I personally use always png icons to simplify distribution.
 
To view this discussion on the web visit https://groups.google.com/d/msg/pyinstaller/-/lfHUI9MDo5MJ.

To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.

nio

unread,
Mar 20, 2012, 3:26:06 PM3/20/12
to pyins...@googlegroups.com
Thanks, I should be able to handle it now! (^_^)

Best regards,

Nicolas.
Reply all
Reply to author
Forward
0 new messages