'telegraphy' as a means of data entry

Elaine Jackson elainejackson7355 at home.com
Mon Sep 13 00:32:43 EDT 2004


This is exactly what I was looking for. Thanks very much for the assist.

"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:mailman.3203.1094997692.5135.python-list at python.org...
| Peter Hansen wrote:
|
| > > | > I need to record the respective times of the events in a sequence of
| > > | > presses/releases of a particular key on the computer keyboard.
|
| > And Tkinter could certainly do it to, but I don't do Tkinter. :)
|
| in Tkinter, you'll find the event time (in milliseconds) in the time
| attribute of the event descriptor:
|
|     from Tkinter import *
|
|     frame = Frame(width=100, height=100)
|     frame.pack()
|     frame.focus()
|
|     def handler(event):
|         print event.time / 1000.0
|
|     frame.bind("<Key>", handler)
|
|     mainloop()
|
| the above only tracks key presses; if you need to track releases
| as well, add an extra binding for KeyRelease.
|
| also note that unlike Peter's example, the time attribute contains
| the time when the event was generated, not when it reached your
| program.
|
| </F>
|
|
|





More information about the Python-list mailing list