Increase efficiency kbcheck?

Hi,

I’m currently using PTB to show a moving slider on the screen. Beforehand, this was controlled by the mouse and it run quite smoothly. Unfortunately, I am now required to use keys from a keyboard to control it. This has caused the code to be extremely slow if I want high “resolution” (I am already calling ‘RestrictKeysForKbCheck’). I am using code very similar to this. If anyone has any ideas on how to speed it up, it would be greatly appreciated.

What operating system? And are you sure it is KbCheck itself? Have you timed it? Linux and Windows should be rather fast for KbChecks? macOS was not great at the beginning, turned worse over time, and reached an all new low with 10.15 Catalina.

I’m using windows 10. I’m using exactly the same code as before -when it worked efficiently- the only difference is that instead of calling GetMouse I use KbCheck. I guess mouse coordinates can change quite drastically with each loop iteration, which achieves a faster moving scale and that is why it was giving me a better result.

Its hard to say from here, but sounds it logic, not kbcheck. If you have many steps along the line, it will take many times kbcheck (and thus many screen refreshes, assuming its inside that loop) and thus a lot of time to move the marker from one end of the line to the other. If you’re forced to use that, consider implementing bigger steps when shift is held down, or something like that

Yes, that’s the only solution I can see (increasing steps when held down).