Created
January 29, 2011 03:47
-
-
Save yurenju/801496 to your computer and use it in GitHub Desktop.
object.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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