Python – How to add a Widget or a Region to an Status Icon in PyGTK


This is my first question in StackOverflow, so I would try to explain my self the best I can.

I made an small app trying to emularte the windows Procastination Killer Application, using pygtk and pygame for the sound alerts.

Here is a video of my little app running

My Issue is that I want to get a widget in the tray icon area, and not jus the plain Icon. Something like an Icon and a Label, to made a counter, or at least extend the icon size to put more information in the status icon.

So my Questions would be:

  1. How can I resize the status icon? for example to show a icon 44×22 pixels
  2. How can I add a Widget, Region, or something else instead the status icon

Here is the code that use to get the status icon.

self.status_icon = gtk.StatusIcon()

self.status_icon.set_tooltip("Switch, a procastination killer app")
self.status_icon.connect("activate", self.on_toggle_status_trayicon)
self.status_icon.connect("popup-menu", lambda i, b, a: self.status_menu.popup(
None, None, gtk.status_icon_position_menu, b, a, self.status_icon))

I am packaging the app for ubuntu soon as I find a name :), that maybe would be me third question.

3: How do I name my app?

Best Solution

GTK+ doesn't support arbitrary widgets in the notification area, because these don't work well in Windows. You probably want to write a panel applet instead -- here's a tutorial for panel applets in PyGTK.