amorriscode / terminal-hero

Bringing musical skills and fast fingers to a terminal near you 🤘
MIT License
5 stars 2 forks source link

Deep dive on input processing with Python #29

Open hyshka opened 3 years ago

hyshka commented 3 years ago

We need to investigate some options for handling keyboard input on a lower level than asciimatics provides us with. This will let us bypass OS-level keyboard settings and give us the ability to handle both key up and key down events.

hyshka commented 3 years ago

Input handling libraries

Frameworks

Tutorials

Examples

hyshka commented 3 years ago
amorriscode commented 3 years ago

I'll admit, I haven't had much time to dig into this but this looks useful: https://stackoverflow.com/questions/27215326/tkinter-keypress-keyrelease-events

hyshka commented 3 years ago

^^^ appears as though tkinter also relies on opening a second window, similar to pygame, python-tcod, etc.

Really cool that this is built into python though!

amorriscode commented 3 years ago

Oh, whoops. I never had a chance to run it but wasn't clear that was the case. My bad. 😳

hyshka commented 3 years ago

Asciimatics input handling

Notable side effects

Functional workarounds

amorriscode commented 3 years ago

Excellent research!

I think we should just do the first workaround. No one should expect this to be a replacement for Guitar Hero (at least for v1). If they really want a perfect clone with a keyboard, they can play Frets on Fire. :)

hyshka commented 3 years ago

Okay, that sounds good to me and prevents the need to workaround OS-level stuff manually.