added button
This commit is contained in:
15
app.py
15
app.py
@@ -3,7 +3,20 @@ import gi
|
|||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
win = Gtk.Window()
|
|
||||||
|
class MyWindow(Gtk.Window):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(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")
|
||||||
|
|
||||||
|
|
||||||
|
win = MyWindow()
|
||||||
win.connect("destroy", Gtk.main_quit)
|
win.connect("destroy", Gtk.main_quit)
|
||||||
win.show_all()
|
win.show_all()
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user