Mercurial > urwid-satext
comparison examples/menu.py @ 43:e49d8f289a73
menu example: ortho fix in comments :)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 20 Feb 2011 00:41:21 +0100 |
parents | 585302e84c1f |
children | 287ff3e1edd1 |
comparison
equal
deleted
inserted
replaced
42:585302e84c1f | 43:e49d8f289a73 |
---|---|
44 def buildMenu(self): | 44 def buildMenu(self): |
45 self.menu = Menu(self.loop) | 45 self.menu = Menu(self.loop) |
46 _menu1 = "Menu 1" | 46 _menu1 = "Menu 1" |
47 self.menu.addMenu(_menu1, "Item 1", self.menu_cb) #Adding a menu is quite easy | 47 self.menu.addMenu(_menu1, "Item 1", self.menu_cb) #Adding a menu is quite easy |
48 self.menu.addMenu(_menu1, "Item 2", self.menu_cb) #Here the callback is always the same, | 48 self.menu.addMenu(_menu1, "Item 2", self.menu_cb) #Here the callback is always the same, |
49 self.menu.addMenu(_menu1, "Item 3", self.menu_cb) #but you use differents one in real life :) | 49 self.menu.addMenu(_menu1, "Item 3", self.menu_cb) #but you use different ones in real life :) |
50 self.menu.addMenu(_menu1, "Exit (C-x)", self.exit_cb, 'ctrl x') #You can also add a shortcut | 50 self.menu.addMenu(_menu1, "Exit (C-x)", self.exit_cb, 'ctrl x') #You can also add a shortcut |
51 _menu2 = "Menu 2" | 51 _menu2 = "Menu 2" |
52 self.menu.addMenu(_menu2, "Item 1", self.menu_cb) | 52 self.menu.addMenu(_menu2, "Item 1", self.menu_cb) |
53 self.menu.addMenu(_menu2, "Item 2", self.menu_cb) | 53 self.menu.addMenu(_menu2, "Item 2", self.menu_cb) |
54 self.menu.addMenu(_menu2, "Item 3", self.menu_cb) | 54 self.menu.addMenu(_menu2, "Item 3", self.menu_cb) |