GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Source-Code-from-Tutorials/PythonGTK/Examples/23_menu.py at master · scibilo/Source-Code-from-Tutorials Expand file tree/ Copy path23_menu.pyMore file actions 45 lines (32 loc) · 1.15 KB / Copy path23_menu.pyFile metadata and controls45 lines (32 loc) · 1.15 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 from gi.repository import Gtk # gsettings set com.canonical.Unity always-show-menus true class MenuExampleWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="") self.set_default_size(400, 300) # Layout layout = Gtk.Box() self.add(layout) # Main container that we will stick inside our layout main_menu_bar = Gtk.MenuBar() # Drop down menu file_menu = Gtk.Menu() file_menu_dropdown = Gtk.MenuItem("File") # File menu items file_new = Gtk.MenuItem("New") file_open = Gtk.MenuItem("Open") file_exit = Gtk.MenuItem("Exit") # File button has dropdown file_menu_dropdown.set_submenu(file_menu) # Add menu items file_menu.append(file_new) file_menu.append(file_open) file_menu.append(Gtk.SeparatorMenuItem()) file_menu.append(file_exit) # Add to main menu bar main_menu_bar.append(file_menu_dropdown) layout.pack_start(main_menu_bar, True, True, 0) window = MenuExampleWindow() window.connect("delete-event", Gtk.main_quit) window.show_all() Gtk.main() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |