6

I am using this code to try to add submenus in appindicator

#!/usr/bin/env python
import gobject
import gtk
import appindicator

def clean_quit(w):
  print "in quit"
  gtk.main_quit()

    if __name__ == "__main__":
      ind = appindicator.Indicator ("example-simple-client",
                              "indicator-messages",
                              appindicator.CATEGORY_APPLICATION_STATUS)
  ind.set_status (appindicator.STATUS_ACTIVE)
  ind.set_attention_icon ("indicator-messages-new")

  # create a menu
  menu = gtk.Menu()
  listMenu=gtk.Menu()
  listItems=gtk.MenuItem("Show List")
  listItems.set_submenu(listMenu)
  inews = gtk.MenuItem("Import")
  listMenu.append(inews)
  menu.append(listItems)
  listItems.show()
  # create some
  menu_items=gtk.MenuItem("Quit")
  menu.append(menu_items)
  menu_items.connect("activate", clean_quit)
  menu_items.show()
  ind.set_menu(menu)

  gtk.main()

It's not working - what is wrong in this code?

4

You also forgot to call inews.show().

1

It looks like you forgot to call listMenu.show().

  • no its still the same – Parimal N Jun 21 '12 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.