a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment
ChuckDurkhiem  ·  2912 days ago  ·  link  ·    ·  parent  ·  post: Password Project

Basically I need to record the time stamp of a keystroke as well as the key pressed. From there I can put it trim it down to a record of the overall rhythm you type the password in. I'm not very far at this point so bare with me.

from tkinter import # tkinter had to be lowercase for my version

from time import time

start_time = end_time = 0

master = Tk()

e = Entry(master)

e.pack()

e.focus_set()

#* Mine

entList = [] # this will be a 2-dimentional list

entInx = 0 # I wasn't sure what this is

def key(event):

    if event.char == '\r':

e.unbind("<Key>")

return

    print ("pressed", repr(event.char))  # print seems to need an extra cupping

end_time = time()

meas_time = int(end_time-start_time) #determine the measured time

print ("measured time:", meas_time)

entPair = [0,0] # I put this here so it would restart each keypress

entPair[0] = event.char # place the char into pos 1 of the line

entPair[1] = meas_time # place the int time into pos 2 of the line

entList.append(entPair) # place the line into the 2d list

    print(entList)  # print the list and make Luka smile

e.bind("<Key>", key)

start_time = time()

mainloop()