You are not logged in.
Pages: 1
I have searched the web for a working python application using gtk.StatusIcon (new in gtk 2.10), which can enable and disable the tray icon. But I have not fond it. The reason for the search is that I'm having some problems with my implemantation of this. It works in the Gnome tray and in pypanel, but not in the KDE tray. This is a small code demonstrating the problem (if you click the remove button, the icon should hide and the pop up again after a short time):
#!/usr/bin/env python
import gtk, pygtk, gobject
tray_icon = gtk.status_icon_new_from_stock(gtk.STOCK_INFO)
def show_menu(status_icon, button, activate_time, menu):
menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, status_icon)
def hide_icon(widget):
tray_icon.set_visible(False)
gobject.timeout_add(5000, show_icon, None)
def show_icon(widget):
tray_icon.set_visible(True)
return False
tray_menu = gtk.Menu()
menu_hide = gtk.ImageMenuItem(gtk.STOCK_REMOVE)
menu_hide.connect("activate", hide_icon)
tray_menu.append(menu_hide)
tray_menu.append(gtk.SeparatorMenuItem())
menu_quit = gtk.ImageMenuItem(gtk.STOCK_CLOSE)
menu_quit.connect("activate", lambda w: gtk.main_quit())
tray_menu.append(menu_quit)
tray_menu.show_all()
tray_icon.connect('popup-menu', show_menu, tray_menu)
tray_icon.set_tooltip("Right click me!")
gtk.main()
Any tips for how to fix this?
Offline
I would file a bug report against gtk+. My application can use gtk.StatusIcon in svn, but I haven't tested it in kde and I don't really plan on it. I don't see anything strange that you're doing.
I am a gated community.
Offline
Pages: 1