Skip to content

Instantly share code, notes, and snippets.

@Seth-Johnson
Created December 28, 2014 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seth-Johnson/9072d70b61f3b7da74d6 to your computer and use it in GitHub Desktop.
Save Seth-Johnson/9072d70b61f3b7da74d6 to your computer and use it in GitHub Desktop.
Gtk testing stuff
from gi.repository import Gtk
win = None
class MyFirstWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="First Class")
self.button1 = Gtk.Button(label="Click me. Quick!")
self.button1.connect("clicked", self.on_button_clicked)
self.add(self.button1)
def on_button_clicked(self, widget):
win = MySecondWindow()
win.show_all()
class MySecondWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Second class")
self.button2 = Gtk.Button(label="Don't click me!")
self.add(self.button2)
win = MyFirstWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment