0

I have running simple wxpython application reside in Taskbar/System-tray area that shows popup menu when user click on it. Work fine except I need to show popup menu when user click right mouse button on Taskbar icon (mac).

Binding right click like:

self.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.onRight) 

do not do anything.

Nilay Anand
  • 330
  • 4
  • 17
  • Do you mean the menu bar, or the Dock? There's no direct equivalent of the system tray on Mac. – Cathy Apr 30 '13 at 03:55
  • I meant menu bar which is created using wx.TaskBarIcon class. Binding right click like: self.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.onRight) do not do anything. – Nilay Anand Apr 30 '13 at 07:33
  • It seems wxPython which has known issue of not firing the event on right click. [See this link](http://trac.wxwidgets.org/ticket/14646) – Nilay Anand Nov 15 '13 at 07:19

2 Answers2

0

You don't need to bind the event directly. The wx.TaskBarIcon has a method to add a right-click menu, although the wxPython docs are a bit light-on, the wxWigets docs explain it quite well.

If the C++ docs confuse you, have a look at the excellent Mouse vs Python tutorial on taskbar icons.

ETA:

Note that by default wxPython gives you the wxWigets menubar item on Mac, which as far as I can tell, only captures a left-click event (line 353). You can get a dock taskbar item if you construct your item passing the right magic words:

wx.TaskBarIcon(wx.TBI_DOCK)

This can capture left and right clicks.

Cathy
  • 515
  • 7
  • 23
  • On Windows7, right click menu works fine without binding any event. On Mac, left click menu works by default and I need to show same menu on right click too. I'm not able to find any documentation that explain how to show task bar menu on right-click on MacOS – Nilay Anand May 01 '13 at 06:23
  • Take another look at that Mouse vs Python tutorial. The second code example includes a `MailIcon` class that subclasses wx.TaskBarIcon and overrides CreatePopupMenu. – Cathy May 01 '13 at 23:44
0

This is known issue of wxwidget 2.9.4 in which event is not triggered when taskbaricon is right clicked. http://trac.wxwidgets.org/ticket/14646

Nilay Anand
  • 330
  • 4
  • 17