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/10_labels.py at master · omidnasri/Source-Code-from-Tutorials Expand file tree/ Copy path10_labels.pyMore file actions 65 lines (51 loc) · 2.3 KB / Copy path10_labels.pyFile metadata and controls65 lines (51 loc) · 2.3 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 from gi.repository import Gtk class LabelWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Label Example") self.set_border_width(20) self.set_default_size(500, 300) # set_homogeneous() - if True, all children get equal space hbox = Gtk.Box(spacing=20) hbox.set_homogeneous(False) vbox_left = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) vbox_left.set_homogeneous(False) vbox_right = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) vbox_right.set_homogeneous(False) # Make two columns hbox.pack_start(vbox_left, True, True, 0) hbox.pack_start(vbox_right, True, True, 0) # Normal label = Gtk.Label("This is a normal label") vbox_left.pack_start(label, True, True, 0) # Left justified label = Gtk.Label() label.set_text("This is a left-justified label.\nWith multiple lines.") label.set_justify(Gtk.Justification.LEFT) vbox_left.pack_start(label, True, True, 0) # Right justified label = Gtk.Label("This is a right-justified label.\nWith multiple lines.") label.set_justify(Gtk.Justification.RIGHT) vbox_left.pack_start(label, True, True, 0) # Line wrap label = Gtk.Label("Drumstick biltong chuck, tongue porchetta jerky jowl bacon pig kevin. Tail shankle cupim.") label.set_line_wrap(True) vbox_right.pack_start(label, True, True, 0) # Fill (newspaper) label = Gtk.Label("Drumstick biltong chuck, tongue porchetta jerky jowl bacon pig kevin. Tail shankle.") label.set_line_wrap(True) label.set_justify(Gtk.Justification.FILL) vbox_right.pack_start(label, True, True, 0) # Markup label = Gtk.Label() label.set_markup("<small>small</small>\n " "<big>big</big>\n" "<b>bold</b>\n" "<i>italic</i>\n" "<a href=\"https://www.thenewboston.com\" title=\"Will appear on hover\">Learn Stuff</a>") label.set_line_wrap(True) vbox_right.pack_start(label, True, True, 0) self.add(hbox) window = LabelWindow() 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. |