Context: I am using arrow keys to adjust the height of a bar continuously changing in height. I am trying to stop participants from adjusting the bar’s size to <0 by counting how many down presses they make, and not applying adjustments to the bar after they have made enough keypresses to make the bar’s size <0.
Here is the code I use to try do this:
Unfortunately, after several down key presses I get the Error: Unable to convert nan to numerical. This error disappears if I remove line 12:
if DownKeyCount < 8:
Does anyone have any idea why this line of code appears to be triggering a nan to numerical error?
Thank you in advance!