python-gtk3-tutorial/hello-world.py
2016-06-14 12:33:16 -04:00

24 lines
525 B
Python
Executable File

#!/usr/bin/env python3
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title = "Hello World!")
self.button = Gtk.Button(label = "Click Me")
self.button.connect("clicked", self.on_button_clicked)
self.add(self.button)
def on_button_clicked(self, widget):
print("Hello World!")
window = MyWindow()
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()