1from gi.repository import Gtk 2import sys 3 4 5class MyWindow(Gtk.ApplicationWindow): 6 7 def __init__(self, app): 8 Gtk.Window.__init__(self, title="Paned Example", application=app) 9 self.set_default_size(450, 350) 10 11 # a new widget with two adjustable panes, 12 # one on the left and one on the right 13 paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL) 14 15 # two images 16 image1 = Gtk.Image() 17 image1.set_from_file("gnome-image.png") 18 image2 = Gtk.Image() 19 image2.set_from_file("tux.png") 20 21 # add the first image to the left pane 22 paned.add1(image1) 23 # add the second image to the right pane 24 paned.add2(image2) 25 26 # add the panes to the window 27 self.add(paned) 28 29 30class MyApplication(Gtk.Application): 31 32 def __init__(self): 33 Gtk.Application.__init__(self) 34 35 def do_activate(self): 36 win = MyWindow(self) 37 win.show_all() 38 39 def do_startup(self): 40 Gtk.Application.do_startup(self) 41 42app = MyApplication() 43exit_status = app.run(sys.argv) 44sys.exit(exit_status) 45