How to Detect Key Down Events?

Maddy
Wed, 22 Feb 2023 11:28:35 +0000
General Usage

I want to detect key presses while my main program loop runs. Say I’m computing loads of data and printing that in the REPL. I want to be able to detect any keys I press. For example, if the key ‘p’ is pressed, all the computation pauses. However, I don’t JUST wish to pause. Maybe I run a function or anything. Basically, I want to be able to detect key-down events.
How can I achieve that?
And of course I’m not talking about readline() since that requires you to press ENTER. Also, that prevents the rest of the program from running (Tell me if that can work with an @async loop. I couldn’t get it to work)
I don’t want to use 3rd party packages like GTK or Makie. Just simple Key event detection!

6 posts - 2 participants