Results 1 to 9 of 9

Thread: Tray icon using PyGTK

  1. #1
    Join Date
    Sep 2005
    Location
    Warsaw, Poland
    Beans
    12
    Distro
    Ubuntu Breezy 5.10

    Tray icon using PyGTK

    Hi!
    I'm modyfing a little IRC app called Urk (I don't know Python well but this application is so simple...). One of new features listed by me is to minimize program to tray...

    Can anybody write me an example for this action? I have already searched Net, but I didn't find anything useful.

    Thanks!
    Last edited by oldfred; May 19th, 2015 at 08:42 PM.

  2. #2
    Join Date
    Jan 2006
    Location
    Philadelphia
    Beans
    4,076
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Tray icon using PyGTK

    check out the pygtk page (http://www.pygtk.org/), and search for word "trayicon"

    you will see that a package called GnomePythonExtras provides an interface for making trayicons in gnome. that should be helpful.

  3. #3
    Join Date
    Sep 2005
    Location
    Warsaw, Poland
    Beans
    12
    Distro
    Ubuntu Breezy 5.10

    Re: Tray icon using PyGTK

    Yes, thanks. But... there's no search on PyGTK.org, and using Google (trayicon siteygtk.org) i found nothing...

  4. #4
    Join Date
    Sep 2005
    Location
    Crevillent (Alicante), Sp
    Beans
    69
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Tray icon using PyGTK

    You should install the packages python-gnome2-extras, python-gnome2-extras-dev and python-gnome2-extras-doc. Then you can find an example program at /usr/share/doc/python-gnome2-extras/examples/egg/trayicon.py. I'm using dapper but it should be the same in breezy.

  5. #5
    Join Date
    Mar 2005
    Location
    Vancouver, Canada
    Beans
    287

    Re: Tray icon using PyGTK

    Here's a quick example:
    Code:
    #! /usr/bin/python
    
    import gtk
    import egg.trayicon 	# egg == python-gnome2-extras
    
    def callback(widget, ev):
    	print "Button %i pressed!" % ev.button
    
    
    tray = egg.trayicon.TrayIcon("TrayIcon")
    box = gtk.EventBox()
    label = gtk.Label("Click Me!")
    box.add(label)
    tray.add(box)
    tray.show_all()
    
    box.connect("button-press-event", callback)
    
    gtk.main()

  6. #6
    Join Date
    Jan 2006
    Location
    Ontario, Canada
    Beans
    708

    Re: Tray icon using PyGTK

    Quote Originally Posted by psychicdragon View Post
    Here's a quick example:
    Code:
    #! /usr/bin/python
    
    import gtk
    import egg.trayicon 	# egg == python-gnome2-extras
    
    def callback(widget, ev):
    	print "Button %i pressed!" % ev.button
    
    
    tray = egg.trayicon.TrayIcon("TrayIcon")
    box = gtk.EventBox()
    label = gtk.Label("Click Me!")
    box.add(label)
    tray.add(box)
    tray.show_all()
    
    box.connect("button-press-event", callback)
    
    gtk.main()
    Is there any documentation on egg.trayicon?

  7. #7
    Join Date
    Jun 2007
    Beans
    692

    Re: Tray icon using PyGTK

    egg.trayicon is actually deprecated, but I've used it for backwards compatibility before (gtk.StatusIcon is somewhat new). I couldn't find any documentation on it though, I just looked for code samples.

  8. #8
    Join Date
    Jan 2006
    Location
    Ontario, Canada
    Beans
    708

    Re: Tray icon using PyGTK

    Quote Originally Posted by imdano View Post
    egg.trayicon is actually deprecated, but I've used it for backwards compatibility before (gtk.StatusIcon is somewhat new). I couldn't find any documentation on it though, I just looked for code samples.
    Well, I need something (anything, I don't care), that will let me stick an icon and a label in the system tray with c++. Does either gtk.StatusIcon or the egg thing let me put a label or other simple widget in the system tray?

  9. #9
    Join Date
    Jan 2006
    Location
    Philadelphia
    Beans
    4,076
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Tray icon using PyGTK

    Quote Originally Posted by solarwind View Post
    Well, I need something (anything, I don't care), that will let me stick an icon and a label in the system tray with c++. Does either gtk.StatusIcon or the egg thing let me put a label or other simple widget in the system tray?
    yes it does. if you don't care about supporting versions of gtk prior to 2.10, use gtk.StatusIcon. it's nice.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •