Paned (Python) Marta Maria Casetti mmcasetti@gmail.com 2012 A widget with two adjustable panes Luc Rebert, traduc@rebert.name 2011 Alain Lojewski, allomervan@gmail.com 2011-2012 Luc Pionchon pionchon.luc@gmail.com 2011 Bruno Brouard annoa.b@gmail.com 2011-12 Luis Menina liberforce@freeside.fr 2014 Paned

Two images in two adjustable panes, horizontally aligned.

Code utilisé pour générer cet exemple from gi.repository import Gtk import sys class MyWindow(Gtk.ApplicationWindow): def __init__(self, app): Gtk.Window.__init__(self, title="Paned Example", application=app) self.set_default_size(450, 350) # a new widget with two adjustable panes, # one on the left and one on the right paned = Gtk.Paned.new(Gtk.Orientation.HORIZONTAL) # two images image1 = Gtk.Image() image1.set_from_file("gnome-image.png") image2 = Gtk.Image() image2.set_from_file("tux.png") # add the first image to the left pane paned.add1(image1) # add the second image to the right pane paned.add2(image2) # add the panes to the window self.add(paned) class MyApplication(Gtk.Application): def __init__(self): Gtk.Application.__init__(self) def do_activate(self): win = MyWindow(self) win.show_all() def do_startup(self): Gtk.Application.do_startup(self) app = MyApplication() exit_status = app.run(sys.argv) sys.exit(exit_status)
Useful methods for a Paned widget

To have two vertically aligned panes, use Gtk.Orientation.VERTICAL instead of Gtk.Orientation.HORIZONTAL. The method add1(widget1) will add the widget1 to the top pane, and add2(widget2) will add the widget2 to the bottom pane.

Références API

Dans cet exemple, les éléments suivants sont utilisés :

GtkPaned

Standard Enumerations

GtkImage