[Glade-users] Help with a tray icon.
- From: jmouriz at gmail.com (Juan Manuel Mouriz)
- Subject: [Glade-users] Help with a tray icon.
- Date: Tue, 20 Apr 2010 13:16:23 +0000
2010/4/20 Sebastian Alonso <alon.sebastian at gmail.com>:
This is my first email on the list, so, Hello world!
I have a little problem working with a tray icon, I'm developing with python
+ pyGTK, and I need to have a tray icon, so whenever I minimize the program
it goes to the tray and whenever I click the tray icon the program comes up
again...
I'll thank pretty much any help, I've been googleing a lot and never found
nothing really useful... so, any article, any advice, a tip, whatever,
everything is really helpful right now :)
thanks everyone...
Hello,
If your program "comes up again" is because you explicitly make this
somewhere in the code. You must connect activate signal of the tray
icon and use hide/show methods in the callback to manage the window
visibility like this example:
#!/usr/bin/python
import gtk
def visibility_handler(window):
visible = window.get_property("visible")
if visible:
window.hide()
else:
window.show()
def activate_callback(icon, window):
visibility_handler(window)
def delete_callback(window, event):
visibility_handler(window)
window = gtk.Window()
window.connect("delete-event", delete_callback)
label = gtk.Label("test window")
label.show()
window.add(label)
icon = gtk.StatusIcon()
icon.set_from_stock(gtk.STOCK_YES)
icon.connect("activate", activate_callback, window)
gtk.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]