Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import pygtk
- pygtk.require('2.0')
- import gtk
- class HelloWorld:
- def hello(self, widget, data=None):
- print "Hello World"
- def delete_event(self, widget, event, data=None):
- print "delete event occurred"
- return False
- def destroy(self, widget, data=None):
- print "destroy signal occurred"
- gtk.main_quit()
- def __init__(self):
- self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
- self.window.connect("delete_event", self.delete_event)
- self.window.connect("destroy", self.destroy)
- self.window.set_border_width(10)
- self.box = gtk.VBox(False, 0)
- self.window.add(self.box)
- self.button = gtk.Button("Close Window")
- self.button.connect("clicked", self.hello, None)
- self.button.connect_object("clicked", gtk.Widget.destroy, self.window)
- self.box.pack_start(self.button)
- self.entry1=gtk.Entry()
- self.box.pack_start(self.entry1)
- self.entry2=gtk.Entry()
- self.box.pack_start(self.entry2)
- self.entry3=gtk.Entry()
- self.box.pack_start(self.entry3)
- self.entry4=gtk.Entry()
- self.box.pack_start(self.entry4)
- self.window.show_all()
- self.entry2.grab_focus()
- def main(self):
- gtk.main()
- if __name__ == "__main__":
- hello = HelloWorld()
- hello.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement