Created
August 31, 2011 13:25
-
-
Save son-link/1183530 to your computer and use it in GitHub Desktop.
Script para hacer pruebas con icono en la barra de estado
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
import gtk, gobject | |
class StatusIcon: | |
def __init__(self): | |
self.statusicon = gtk.StatusIcon() | |
self.statusicon.set_from_stock(gtk.STOCK_HOME) | |
self.statusicon.connect("popup-menu", self.right_click_event) | |
self.statusicon.connect('activate', self.left_click_event) | |
def left_click_event(*args): | |
print 'Botón izquierdo' | |
def right_click_event(self, icon, button, time): | |
print 'Botón derecho' | |
menu = gtk.Menu() | |
about = gtk.MenuItem('About') | |
quit_menu = gtk.MenuItem('Quit') | |
about.connect('activate', self.show_about_dialog) | |
quit_menu.connect('activate', gtk.main_quit) | |
menu.append(about) | |
menu.append(quit_menu) | |
menu.show_all() | |
menu.popup(None, None, gtk.status_icon_position_menu, button, time, self.statusicon) | |
def show_about_dialog(self, widget): | |
about_dialog = gtk.AboutDialog() | |
about_dialog.set_destroy_with_parent(True) | |
about_dialog.set_name("StatusIcon Test") | |
about_dialog.set_version("1.0") | |
about_dialog.set_authors(["Son Link"]) | |
about_dialog.run() | |
about_dialog.destroy() | |
StatusIcon() | |
gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment