Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import gtk,os,random
- class WIN:
- def __init__(self):
- self.CODE=""
- self.win=gtk.Window()
- self.win.connect("destroy", lambda w:gtk.main_quit())
- self.win.show()
- self.win.connect("key-press-event", self.closeme)
- self.win.connect("key-press-event", self.code)
- def closeme(self, widget, event):
- if event.keyval == gtk.keysyms.Escape:
- gtk.main_quit()
- def code(self, widget, event):
- if event.keyval == gtk.keysyms.i:
- self.CODE="i"
- else:
- self.CODE+= chr(event.keyval)
- print self.CODE
- if self.CODE == "idqd":
- self.CODE=''
- mainapp=WIN()
- gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement