Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created January 29, 2011 03:47
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 yurenju/801496 to your computer and use it in GitHub Desktop.
Save yurenju/801496 to your computer and use it in GitHub Desktop.
object.py
#!/usr/bin/env python
import pygtk
pygtk.require ('2.0')
import gtk
class HelloWorld:
def __init__ (self):
window = gtk.Window ()
window.connect ("destroy", self.destroy)
window.show ()
button = gtk.Button ("hello");
button.connect ("clicked", self.hello)
button.show ()
window.add (button)
self.position = 0
def destroy (self, window):
gtk.main_quit ()
def hello (self, button):
print "Hello World, position: %d" % self.position
self.position += 1
if __name__ == "__main__":
hello = HelloWorld ()
gtk.main ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment