Hi,
So the following is the keypress code which I basically got from these two posts here:
My code :
while True:
keys = mykb.getKeys(keysWatched, waitRelease
= False, clear = False)
if len(keys): # if a key has been pressed
for i, key in enumerate(keysWatched):
if keys[-1].name == key:
if keys[-1].duration:
status[i] = 'up'
statusList.append('up')
else:
status[i] = 'down'
statusList.append('down')
teststim.draw()
myline.draw()
mydot.setPos(points[ortho_slider.value,:])
mydot.draw()
if ortho_slider.markerPos and status[2] =='down':
estimated = ortho_slider.value
# print(points[estimated,:])
estimated_val = points[estimated,:]
ortho_slider.reset()
break
elif status[0] =='down':
ortho_slider.value = ortho_slider.value - 1
elif status[1] == 'down':
ortho_slider.value = ortho_slider.value + 1
if 'esc' in keys:
core.quit() ;
My problem is that the speed of the dot is really slow when I hold down either the left or right arrow key. I need the speed to be much faster but have no idea how to begin looking into this. Any help or advice/suggestions would be appreciated !
Basically as I hold down the left or right arrow key the location of some dot on the screen moves along
a line. The values of the slider are indices (n=1001 indices) and those indices contain coordinates for the dot. My variable “points” output/range is the following:
[[ 279.28883032 -44.64667125]
[ 279.03449022 -44.80839039]
[ 278.78015012 -44.97010953]
…
[ 25.45740753 -206.0423736 ]
[ 25.20306743 -206.20409274]
[ 24.94872733 -206.36581189]]