Window (Python) Tiffany Antopolski tiffany.antopolski@gmail.com 2012 Marta Maria Casetti mmcasetti@gmail.com 2012 Une fenêtre de niveau supérieur qui peut contenir d'autres éléments graphiques 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 Fenêtre

A minimal GTK+ Application: a window with a title.

Use if you need support.

Code utilisé pour générer cet exemple from gi.repository import Gtk import sys class MyApplication(Gtk.Application): def do_activate(self): # create a Gtk Window belonging to the application itself window = Gtk.Window(application=self) # set the title window.set_title("Welcome to GNOME") # show the window window.show_all() # create and run the application, exit with the value returned by # running the program app = MyApplication() exit_status = app.run(sys.argv) sys.exit(exit_status)
Méthodes utiles pour un composant graphique fenêtre

set_default_size(200, 100) définit la taille par défaut de la fenêtre à une largeur de 200 et une hauteur de 100 ; si, au lieu d'un nombre positif, vous lui transmettez -1, vous obtenez la taille par défaut.

set_position(Gtk.WindowPosition.CENTER) place la fenêtre au centre de l'écran. Les autres options possibles sont : Gtk.WindowPosition.NONE, Gtk.WindowPosition.MOUSE, Gtk.WindowPosition.CENTER_ALWAYS, Gtk.WindowPosition.CENTER_ON_PARENT.

Références API

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

GtkApplication

GtkWindow