[Tutor] call key on_press event multiple times when key is held down
Carlton Banks
noflaco at gmail.com
Mon Jul 10 02:43:06 EDT 2017
So i tried a different solution, introducing two threads one handling the keyboard,
and the other one is a while true, that keeps running.
https://pastebin.com/U0WVQMYP <https://pastebin.com/U0WVQMYP>
but for some reason, am I constantly running into IOerror, hence
no frames is being recorded. Any suggestion on why?
> Den 4. jul. 2017 kl. 14.45 skrev Carlton Banks <noflaco at gmail.com>:
>
>>
>>> Interesting solution, but still find a bit "dirty hackish”
>>> to involve a timer in this.. I guess it just would be neat if
>>> it just worked as i thought it to be. But i guess i have to look into curses.
>>
>> A timer based loop is actually the standard pattern for
>> implementing a loop in an event driven environment (the
>> main alternative is to launch a background thread).
>> It's how most GUIs handle such scenarios.
>>
>> The problem in a CLI solution is that you have to build your
>> own timer event system (usually based on time.sleep() or
>> similar). Hence the suggestion to use a GUI.
>>
>
> Any suggestion on any GUI solutions?
>
>
> Regards
> Carl
>
More information about the Tutor
mailing list