[wxpython-mac] Transparent systray icon in the Mac OS X dock

Gros Bedo gros_bedo at hotmail.com
Sun Jun 29 18:51:48 PDT 2008


Hi back :-)

> As a workaround you could probably bind to EVT_ACTIVATE_APP and in the handler check for GetActive to see if is being activated or not to call your function. Its odd that the left clicks don't fire events seems like a possible wx bug.

Here's the code I tested:

class fSend(wx.Frame):

	def _init_ctrls(self, prnt):

		# generated method, don't edit | temp:wx.DEFAULT_FRAME_STYLE

		wx.Frame.__init__(self, id=wx.ID_FSEND, name='fSend', parent=prnt, size=wx.Size(573, 360),

			  style=wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN | wx.TAB_TRAVERSAL, title=_('Send screen capture and problem report'))

		#Set up system tray icon tool tip - get from config file if defined, default to "Click to send problem report"

		sTip = mConfig.GetConfig ("Misc", "Icon Tool Tip")

		if (sTip == ''):

			sTip = _("Click to send problem report")

		self.SetToolTipString (sTip)

		self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE))

		self.Center(wx.BOTH)

		self.Show(False)

		self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,

			  'Microsoft Sans Serif'))

		self.Bind(wx.EVT_CLOSE, self.OnFSendClose)

		self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate)

...
	def OnActivate(self,event):

		print("lala1")

		if event.GetActive():

			print("lala2")

			self.OnTaskBarActivate(None)

I also tried wx.EVT_ACTIVATE (without _APP) but none produce any good result. But I don't think it's a wx bug, it seems Mac OS X is programmed to launch the application when clicking on its icon in the dock, and there's no way around to replace with a custom function when this event occurs. No problem with right click. But I can be wrong, I'm new to all this Mac world :-)

I tested with wx.EVT_TASKBAR_CLICK which should activate the application whenever a single click occurs, left right or middle. But on Mac OS X, only right click execute my custom function, the other buttons shows nothing, because my application is already launched. So if someone knows a workaround, I would be glad to hear it ;-) But anyway nevermind it's not very important.

Just one thing I was wondering: could it be possible to just put my application icon in the dock and close it ? Maybe there is a python function to register the icon ?
_________________________________________________________________
Votre contact a choisi Hotmail, l'e-mail ultra sécurisé. Créez un compte gratuitement !
http://www.windowslive.fr/hotmail/default.asp


More information about the wxpython-mac mailing list