File: hello_gtk.py

package info (click to toggle)
gnat-gps 18-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 45,716 kB
  • sloc: ada: 362,679; python: 31,031; xml: 9,597; makefile: 1,030; ansic: 917; sh: 264; java: 17
file content (17 lines) | stat: -rw-r--r-- 556 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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