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/04_boxes.py at master · ayalamac/Source-Code-from-Tutorials Expand file tree/ Copy path04_boxes.pyMore file actions 34 lines (24 loc) · 1.01 KB / Copy path04_boxes.pyFile metadata and controls34 lines (24 loc) · 1.01 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 from gi.repository import Gtk # create a box (invisible container) with widgets inside class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Boxes are Awesome") # 6px between children self.box = Gtk.Box(spacing=6) self.add(self.box) # Create two buttons and put them in the box self.bacon_button = Gtk.Button(label="Bacon") self.bacon_button.connect("clicked", self.bacon_clicked) # Pack_start means just position items in box from left to right self.box.pack_start(self.bacon_button, True, True, 0) self.tuna_button = Gtk.Button(label="Tuna") self.tuna_button.connect("clicked", self.tuna_clicked) self.box.pack_start(self.tuna_button, True, True, 0) def bacon_clicked(self, widget): print("You clicked Bacon") def tuna_clicked(self, widget): print("You clicked Tuna") window = MainWindow() 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. |