[wxPython-users] RE: how to load an icon from a string?

Alec Bennett whatyoulookin at yahoo.com
Fri Dec 7 14:49:48 PST 2007


That's just too slick. For anyone else that comes down
this road, here's how to actually set the icon. Follow
Mike's instructions, then copy the resulting icon.py
file to your project directory, then:

import icon
ICON = icon.getIcon()
self.SetIcon(ICON)






--- Mike Driscoll <mdriscoll at co.marshall.ia.us> wrote:

>  
> 
> > -----Original Message-----
> > From: Alec Bennett
> [mailto:whatyoulookin at yahoo.com] 
> > Sent: Thursday, December 06, 2007 9:56 PM
> > To: wxpython-users at lists.wxwidgets.org
> > Subject: how to load an icon from a string?
> > 
> > The usual way I'm assigning an icon to my program
> window is this:
> > 
> > icon = wx.Icon("icon.ico", wx.BITMAP_TYPE_ICO)
> > self.SetIcon(icon)
> > 
> > I'm wondering if there's a way to load it from a
> string so I 
> > wouldn't have to include the icon file?
> > 
> 
> The wxPython way of doing this is to use the
> included img2py.py tool
> located in
>
C:\Python24\Lib\site-packages\wx-2.8-msw-unicode\wx\tools
> (on
> my Windows box).
> 
> Docs are found here:
>
http://www.wxpython.org/docs/api/wx.tools.img2py-module.html
> 
> I do something like this via command line:
> 
> 1) navigate to the tool directory
> 2) python img2py.py -i pycon.ico icon.py
> 3) copy the file to my project's directory
> 4) call the function you need (see docs above)
> 
> Hope that helps.
> 
> Mike
> Mike
>  
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail:
> wxPython-users-help at lists.wxwidgets.org
> 
> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping




More information about the wxpython-users mailing list