Ubuntu 12.04 application indicator python -


How do I use the menu item in the Python Pointer application?

  Menu = Gtk.Menu () buf = "Quit" menu_items = gtk.MenuItem (Click buf) # miss how close the application? Menu.append (menu_items) menu_items.show () ind.set_menu (menu) gtk.main ()   

I would like to submit the buf menu items Application Close def quit:

it works for me, at the top Import the system.

  import the sys   

And the function that you want to leave are:

  sys.exit (0) < / Code>  

Below are my working examples (except for the applications except for functions):

  #! / Usr / bin / env python # # Author: Stuart Page & lt; Xxx @ gmail.com & gt; # Import gobject import gtk import Recommended import sys def menuitem_response (w, optionName): print option name def left Request (w, optionName): sys.exit (0) If __name__ == "__main__": ind = appindicator.Indicator (" example -simpl-client "," indicator-message ", Apiaidiactor. CATEGORY_APPLICATION_STATUS) Indkset_stets (Apiaidisiactor. STATUS_ACTIVE) Indksnst_atende_ikn (" indicator-message-new ") # Create a menu = gtk.Menu () # some Create Dropdown options optionName = "menu option - 1" menu_items = gtk.MenuItem (optionName) menu.append (menu_items) menu_items.connect ( "activate", menuitem_ Response, optionName) menu_items.show () optionName = "menu option - 2" Menu_items = gtk.MenuItem (optionName) menu.append (menu_items) menu_items.connect ("active", menuitem_response, optionName) menu_items.show () optionName = "Skip" menu_items = gtk.MenuItem (optionName) menu.append (menu_items) Menu_items.connect ("Activate", SkipApplications, OptionsName) menu_items.show () ind.set_menu (menu) gtk.min ()    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -