[wxpython-mac] Transparent systray icon in the Mac OS X dock
Gros Bedo
gros_bedo at hotmail.com
Fri Jun 27 20:41:08 PDT 2008
> From: codyprecord at gmail.com> To: wxpython-mac at lists.wxwidgets.org> Subjec=
t: Re: [wxpython-mac] Transparent systray icon in the Mac OS X dock> Date: =
Fri, 27 Jun 2008 19:07:08 -0500> > Hello,> > On Jun 26, 2008, at 6:25 PM, G=
ros Bedo wrote:> >> >> > Here's my code:> >> > icon =3D wx.Icon ('icon.ico'=
, wx.BITMAP_TYPE_ANY)> > self.tbicon.SetIcon (icon, sTip)> > wx.EVT_TASKBAR=
_LEFT_UP (self.tbicon, self.OnTaskBarActivate)
> What size is your icon? I think that only some "native" sizes are > suppo=
rted on Mac or some scaling might take place and cause you to > loose the a=
lpha channel. If you icon is not (64x64, 128x128), you > might want to try =
one with one of those sizes.> > > Also I am not sure how well using .ico fi=
les works under mac you might > have better luck with a .png image.
Already tested with png images, but it didn't work either. I thought that .=
ico was maybe more appropriate because this is the example icon given with =
wxpython, and it's 32x32.
But your solution is working too ! With a png 128x128 the icon shows flawle=
ssly in the taskbar :-D THANK YOU VERY MUCH (you don't know how many days I=
've been looking for an answer).
=
Anyway I don't like mysteries, so I've investigated why the example icon of=
wxpython works. Apparently, Mac OS X doesn't support 8-bit alpha mask, whi=
ch is the default option in GIMP and for Windows. You have to make an 1-bit=
alpha mask. Secondly, your icon must be 32x32, it will resize it to the go=
od size. Any other size seems to create the "black background bug" (which i=
s in fact the loss of the alpha layer, other people may have a different co=
lor based on the color used for alpha). Color depth doesn't seem to have an=
y effect (tested from 1bpp to 24bpp, 32 bpp produce a bug but it's because =
the alpha layer is 8-bit).
=
So to summary, if anyone else has the same bug: create a 128x128 .png image=
or a 32x32 .ico with 1-bit alpha.
=
This was the worst problem for me, but I would like to know if there is sti=
ll an answer for my second question: is there a way to execute a function w=
hen clicking on the icon in Mac OS X ? As I said I use this:
=
> > icon =3D wx.Icon ('icon.ico', wx.BITMAP_TYPE_ANY)> > self.tbicon.SetIco=
n (icon, sTip)> > wx.EVT_TASKBAR_LEFT_UP (self.tbicon, self.OnTaskBarActiva=
te)
=
I didn't find any other procedure (maybe in pyObjC ?). Anyway, I couldn't s=
ee a single application doing this, so maybe it's simply impossible.
> Hope this helps, otherwise if you can provide a small runnable sample > t=
o test with I can check it out.
I won't bother you to look into my messed code ;p But if you want to get an=
idea, this is to port a program called Panic Button (http://www.panicbutto=
n.co.uk). This is a end-user support software. It summons an icon in the sy=
stray, and when the user click it, it automatically grab a screenshot of th=
e screen and send it to the administrator or helpdesk. That's why I would l=
ike to be able to restore the click on the icon in Mac OS X, but if that's =
impossible I will simply let it like this (there is an option in the rightc=
lick menu which does the same, but it's less intuitive).
=
PS: Can I add you in the Special Thank page ?
_________________________________________________________________
Retouchez, classez et partagez vos photos gratuitement avec le logiciel Gal=
erie de Photos !
http://www.windowslive.fr/galerie/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-mac/attachments/20080628=
/dffcbd76/attachment.htm
More information about the wxpython-mac
mailing list