Window (Python) Tiffany Antopolski tiffany.antopolski@gmail.com 2012 Marta Maria Casetti mmcasetti@gmail.com 2012 Un botón de primeiro nivel que pode conter a outros widgets Fran Dieguez frandieguez@gnome.org 2012-2013. Xanela

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

Use if you need support.

Código usado para xerar este exemplo 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étodos útiles para o widget de Xanela

set_default_size(200, 100) sets the default size of the window to a width of 200 and a height of 100; if instead of a positive number we pass -1 we have the default size.

set_position(Gtk.WindowPosition.CENTER) centers the window. Other options are Gtk.WindowPosition.NONE, Gtk.WindowPosition.MOUSE, Gtk.WindowPosition.CENTER_ALWAYS, Gtk.WindowPosition.CENTER_ON_PARENT.

API References

Neste exemplo empregaremos o seguinte:

GtkApplication

GtkWindow