[Tutor] How to enable pausing my stop_watch.py ? (original) (raw)

Dick Moores rdm at rcblue.com
Thu Jul 8 10:39:17 CEST 2004


Dick Moores wrote at 01:16 7/8/2004:

Alan Gauld wrote at 12:04 7/7/2004:

An example in my event driven programming topic in my tutor Here's that page without the frame: http://www.freenetpages.co.uk/hp/alan.gauld/tutevent.htm I'm afraid I don't understand enough to know where to put this line: self.txtBox.bind("", self.doKeyEvent)

I've got it now: """ from Tkinter import *

class KeysApp(Frame): def init(self): Frame.init(self) self.txtBox = Text(self) self.txtBox.bind("", self.doQuitEvent) self.txtBox.pack() self.pack() self.txtBox.bind("", self.doKeyEvent)

 def doKeyEvent(self,event):
     str = "%d\n" % event.keycode
     self.txtBox.insert(END, str)
     return "break"

 def doQuitEvent(self,event):
     import sys
     sys.exit()

myApp = KeysApp() myApp.mainloop() ""

Sorry about that.

Dick Moores



More information about the Tutor mailing list