Files
gnatstudio/examples/python/hello_gtk.py
Nicolas Roche 52ce0edb86 Ensure examples do conform to pep8 and pyflakes
Change-Id: I767f41b0dd7eeae605b175165fff3bb0c235557f
2017-06-27 15:37:18 +02:00

18 lines
556 B
Python

# This file shows how to create a simple graphical window using the
# gtk python module
from gi.repository import Gtk
def hello_cb(button):
window.destroy()
window = Gtk.Window(Gtk.WindowType.TOPLEVEL) # create a top level window
window.set_border_width(10) # set padding round child widget
button = Gtk.Button("Hello World")
button.connect("clicked", hello_cb) # call hello_cb when clicked
window.add(button) # add button to window
window.show_all() # show window and its children