'telegraphy' as a means of data entry
Fredrik Lundh
fredrik at pythonware.com
Sun Sep 12 09:44:03 EDT 2004
More information about the Python-list mailing list
Sun Sep 12 09:44:03 EDT 2004
- Previous message (by thread): 'telegraphy' as a means of data entry
- Next message (by thread): 'telegraphy' as a means of data entry
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Previous message (by thread): 'telegraphy' as a means of data entry
- Next message (by thread): 'telegraphy' as a means of data entry
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list