blob: c8e0bbd6328974eabc422664367a121b016e61ec [file] [log] [blame]
Philipp Schrader7520ee62022-12-10 14:04:40 -08001# This is the extended example from
2# https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html#extended-example
3
4import gi
5
6gi.require_version("Gtk", "3.0")
7from gi.repository import Gtk
8
9
10class MyWindow(Gtk.Window):
11
12 def __init__(self):
13 super().__init__(title="Hello World")
14
15 self.button = Gtk.Button(label="Click Here")
16 self.button.connect("clicked", self.on_button_clicked)
17 self.add(self.button)
18
19 def on_button_clicked(self, widget):
20 print("Hello World")
21
22
23win = MyWindow()
24win.connect("destroy", Gtk.main_quit)
25win.show_all()
26Gtk.main()