import gtk
import gobject

def on_right_click(widget, event_button, event_time):
    make_menu(event_button, event_time)

def make_menu(event_button, event_time):
    menu = gtk.Menu()
    item = gtk.MenuItem('hi')
    item.show()
    menu.append(item)
    menu.popup(None, None,
        gtk.status_icon_position_menu, event_button,
	event_time, icon)


icon = gtk.status_icon_new_from_stock(gtk.STOCK_QUIT)
icon.connect('popup-menu', on_right_click)

gtk.main()

