hello.py 462 B

12345678910111213141516171819
  1. #!/usr/bin/python
  2. from gi.repository import Gtk
  3. class MyWindow(Gtk.Window):
  4. def __init__(self):
  5. Gtk.Window.__init__(self, title="Hello World")
  6. self.button = Gtk.Button(label="Click here")
  7. self.button.connect("clicked", self.on_button_clicked)
  8. self.add(self.button)
  9. def on_button_clicked(self, widget):
  10. print ("Hello World")
  11. win = MyWindow()
  12. win.connect("delete-event", Gtk.main_quit)
  13. win.show_all()
  14. Gtk.main()