From bf6068492769c54220dfb442074b80dd5bbce981 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 14 Jun 2016 13:02:49 -0400 Subject: [PATCH] add box.py --- box.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 box.py diff --git a/box.py b/box.py new file mode 100755 index 0000000..68c8078 --- /dev/null +++ b/box.py @@ -0,0 +1,34 @@ +#!/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.box = Gtk.Box(spacing = 6) + self.add(self.box) + + self.button1 = Gtk.Button(label = "Hello") + self.button1.connect("clicked", self.on_button1_clicked) + self.box.pack_start(self.button1, True, True, 0) + + self.button2 = Gtk.Button(label = "Goodbye") + self.button2.connect("clicked", self.on_button2_clicked) + self.box.pack_start(self.button2, True, True, 0) + + def on_button1_clicked(self, widget): + print("Hello!") + + def on_button2_clicked(self, widget): + print("Goodbye!") + Gtk.main_quit() + +window = MyWindow() +window.connect("delete-event", Gtk.main_quit) +window.show_all() + +Gtk.main()