[Eric] howto use icons in pyqt/qtdesigner

Detlev Offenbach detlev at die-offenbachs.de
Sat May 7 17:16:40 BST 2011


On Samstag, 7. Mai 2011, Jeroen Eitjes wrote:
> I Have a pyqt/eric4 project saved in a directory on my harddrive.
> 
> What is the best way to add icons to buttons, etc.?
> 
> My program will be run from other directories than the source dir
> 
> When i just select the file of the icon on the button, (path) than the
> icons are only shown when i start the program in the sourcedir the icons
> are otherwise not shown.
> 
> Resources with icons from qtdesigner give import errors
> 
> I have one workaround. That is to chdir to os.path.dirname(sys.argv[0])
> before loading the main form.
> 
> So what is the right way to do this??
> 
> Cheers Jeroen.

In eric I implemented a pixmap cache manager (UI.PixmapCache), which does all 
the picture and icon loading for me. You may have a look at it.

Regards,
Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list