I have an app written using wxPython 2.8.11, and on MacOSX, the
TaskBarIcon shows up on the dock. I would prefer it be on the menu
bar. Googling yields only the following:
use pyobjc & the standard cocoa api for NSStatusItem to set up a menu
bar item from python.
-Mike
···
On Thu, Dec 2, 2010 at 11:17 PM, btimby <btimby@gmail.com> wrote:
I have an app written using wxPython 2.8.11, and on MacOSX, the
TaskBarIcon shows up on the dock. I would prefer it be on the menu
bar. Googling yields only the following:
On Fri, Dec 3, 2010 at 10:59 AM, Ben Timby <btimby@gmail.com> wrote:
Mike, thanks for the information. Is there a way for that to interact
with the wx.Frames etc. in my app? Any examples you know of?
You will need to be more clear on what you mean but if you mean
interact with a wxFrame from pyobjc then yes. It can be done by
calling wx.Frame.GetHandle() to get the ControlRef that you will need
when working with the cocoa api.
Sorry, yes, here are some details on what I am doing.
The TaskBarIcon (preferably placed in the Mac OSX menu bar and not the
dock) does a couple of things.
1. When clicked, it pops a wx.Frame.
2. On Windows/Linux, when right clicked it shows a menu:
- Exit
- Open webpage (webbrowser.open)
- Preferences (wx.Dialog)
- Manage (wx.Frame)
Also, this entire app is just a front-end for a daemon, so when the
daemon is working, the icon should be animated, when the daemon is
idle, so is the icon. Right now I animate the icon by using a wx.Timer
that cycles through a wx.ImageList. I start and stop the timer when
the daemon changes state.
That is the extent of my interaction.
···
On Fri, Dec 3, 2010 at 12:09 PM, Cody Precord <codyprecord@gmail.com> wrote:
Hi,
On Fri, Dec 3, 2010 at 10:59 AM, Ben Timby <btimby@gmail.com> wrote:
Mike, thanks for the information. Is there a way for that to interact
with the wx.Frames etc. in my app? Any examples you know of?
You will need to be more clear on what you mean but if you mean
interact with a wxFrame from pyobjc then yes. It can be done by
calling wx.Frame.GetHandle() to get the ControlRef that you will need
when working with the cocoa api.
As far as I know nothing has been changed there. So far nobody has wanted the feature bad enough to do the implementation and submit a patch.
···
On 12/2/10 8:17 PM, btimby wrote:
I have an app written using wxPython 2.8.11, and on MacOSX, the
TaskBarIcon shows up on the dock. I would prefer it be on the menu
bar. Googling yields only the following:
One approach that was discussed in the past was to still use wx.TaskBarIcon for the menubar icons as well. Basically the first TaskBarIcon created would be the dock icon and subsequent TaskBarIcons would go in the menubar. Personally I would prefer something like a flag passed to the constructor that specified that the dock or menubar should be used.
Beyond that I don't know what approach to take or how to implement it as I'm really weak on the Cocoa APIs
···
On 12/3/10 1:17 PM, Ben Timby wrote:
Do you have any thoughts on how such a patch might be implemented? Are
you thinking a wxWidgets or wxPython patch?
On Fri, Dec 3, 2010 at 2:31 PM, Robin Dunn<robin@alldunn.com> wrote:
As far as I know nothing has been changed there. So far nobody has wanted
the feature bad enough to do the implementation and submit a patch.
Robin, I did a bit more research. The menu bar is the bar at the top
of the OSX screen. The right hand side of this menu bar is the status
bar. In reality, I want my icon on the status bar.
The implementation is chosen based on the iconType passed to the
facade class (wxTaskBarIcon) constructor.
In wxPython, taskbar.i does not provide anything of the type.
Now, this is all in wxWidgets trunk, so I don't know when this became
available, but it looks like wxPython could pretty easily inherit this
functionality.
Thoughts?
On Fri, Dec 3, 2010 at 4:56 PM, Robin Dunn <robin@alldunn.com> wrote:
It would have to be in wxWidgets.
One approach that was discussed in the past was to still use wx.TaskBarIcon
for the menubar icons as well. Basically the first TaskBarIcon created
would be the dock icon and subsequent TaskBarIcons would go in the menubar.
Personally I would prefer something like a flag passed to the constructor
that specified that the dock or menubar should be used.
Beyond that I don't know what approach to take or how to implement it as I'm
really weak on the Cocoa APIs
Thanks, I'll look into it further. From the header file it looks like the status item tpye is supported only in the wxOSX-cocoa port, but that is better than nothing.
···
On 12/4/10 4:35 AM, Ben Timby wrote:
Robin, I did a bit more research. The menu bar is the bar at the top
of the OSX screen. The right hand side of this menu bar is the status
bar. In reality, I want my icon on the status bar.
The implementation is chosen based on the iconType passed to the
facade class (wxTaskBarIcon) constructor.
In wxPython, taskbar.i does not provide anything of the type.
Now, this is all in wxWidgets trunk, so I don't know when this became
available, but it looks like wxPython could pretty easily inherit this
functionality.