[pygtk] Help needed with gtk.StatusIcon

Andreas Heinlein aheinlein at gmx.com
Mon Apr 27 18:16:09 WST 2009


Hello,

I have a script (implemented as a nautilus script) which does a fairly
lengthy task. To show the user that something is going on, I wanted to
use a gtk.StatusIcon, preferably a blinking one.
But, the StatusIcon never appears, not even after show()ing it.

It looks like the status icon will only appear when a gtk.main() loop is
running, which is not the case here since the script is a linear task
and has no main loop. I tried to "wrap" the script inside of an idle
function, which is called from a main loop, but that does not work
either (because the idle callback is called only once and then calls
gtk.main_quit(), I assume).

I got it to work using a small blinker.py which does nothing but show
the blinking icon and enter a main loop. This blinker.py is now called
via subprocess.Popen at the beginning of the script and killed via
subprocess.terminate() at the end. I do not like this method, since it
will leave an ever-blinking icon if the main script gets killed or dies
unexpectedly.

Any chance to get a gtk.StatusIcon or similar without a main loop?

Thanks,
Andreas


More information about the pygtk mailing list