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/06_listBox.py at master · Kush22/Source-Code-from-Tutorials Expand file tree/ Copy path06_listBox.pyMore file actions 39 lines (32 loc) · 1.29 KB / Copy path06_listBox.pyFile metadata and controls39 lines (32 loc) · 1.29 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 from gi.repository import Gtk # ListBox is just a vertical container that you can sort, navigate with the keyboard, etc... class ListBoxWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Cheeseburger Machine") self.set_border_width(10) listbox = Gtk.ListBox() listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.add(listbox) # Inside your ListBox are ListBoxRows (widgets go inside them) row_1 = Gtk.ListBoxRow() box_1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=100) row_1.add(box_1) label = Gtk.Label("Check if you love cheeseburgers:") check = Gtk.CheckButton() box_1.pack_start(label, True, True, 0) box_1.pack_start(check, True, True, 0) listbox.add(row_1) # Toggle switch row_2 = Gtk.ListBoxRow() box_2 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=100) row_2.add(box_2) label = Gtk.Label("Burger making machine:") switch = Gtk.Switch() switch.props.valign = Gtk.Align.CENTER box_2.pack_start(label, True, True, 0) box_2.pack_start(switch, True, True, 0) listbox.add(row_2) win = ListBoxWindow() win.connect("delete-event", Gtk.main_quit) win.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. |