add hello-world.py
This commit is contained in:
parent
84a1e9bab0
commit
6dee0aef24
23
hello-world.py
Executable file
23
hello-world.py
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/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()
|
Loading…
x
Reference in New Issue
Block a user