wxMAC Icon bundles.
Christopher Barker
Chris.Barker at noaa.gov
Fri Jan 12 17:08:46 PST 2007
HI all,
I had someone on the pythonmac list ask if wx could read and work with =
OS-X icon bundles (*.icns). It sure looks like a wxIconBundle should be =
able to be created from one, but for the life of me, I can't figure out =
how, and googling didn't help.
I've enclosed a little test code (and sample icon file). This is the key =
line:
I =3D wx.IconBundle()
I.AddIconFromFile("BaroModes.icns", wx.BITMAP_TYPE_ICO)
wx.BITMAP_TYPE_ICO isn't right -- but what is?
Thanks,
-Chris
-- =
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BaroModes.icns
Type: application/octet-stream
Size: 26294 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20070=
112/13b481a0/BaroModes.obj
-------------- next part --------------
#!/usr/bin/env python2.5
import wx
class TestFrame(wx.Frame):
def __init__(self, *args, **kwargs):
print "making a frame"
wx.Frame.__init__(self, *args, **kwargs)
=
self.Bind(wx.EVT_PAINT, self.OnPaint)
=
def OnPaint(self, event):
dc =3D wx.PaintDC(self)
dc.DrawIcon(I, 10, 10)
=
a =3D wx.App(0)
I =3D wx.IconBundle()
I.AddIconFromFile("BaroModes.icns", wx.BITMAP_TYPE_ICO)
#print "Icon ok?", I.Ok()
f =3D TestFrame(None, size=3D(200,200))
f.Show()
a.MainLoop()
More information about the wxpython-users
mailing list