Skip to content
← Back to Community
How to detect "esc" key press in python.
Profile icon
Purple01Flame

I need to learn how to let it detect "esc" so it can back out of apps.

Voters
Profile icon
RauhitKrishnan
Profile icon
Purple01Flame
Comments
hotnewtop
Profile icon
HackermonDev

I don't think you can do this

Profile icon
Purple01Flame

@PDanielY how so?

Profile icon
HackermonDev

@Purple01Flame the python console can only collect characters. The escape key isn't considered a character so it doesn't work

Profile icon
Purple01Flame

@PDanielY hmmmst

Profile icon
Purple01Flame

@PDanielY how do u let it detect a character

Profile icon
HackermonDev

@Purple01Flame You can just use a normal input() function or you can use pyhook

Mark this as answered if it answered your question

Profile icon
Purple01Flame

@PDanielY Your writing in a reminder notepad. There already is an active input.

Profile icon
HackermonDev

@Purple01Flame then use pyhook

Profile icon
ash15khng

@PDanielY Surprisingly when you use input weird stuff happens. The terminal starts printing .upm /main.py?

Profile icon
HackermonDev

@ash15khng hmm report that at repl.it/bugs

Profile icon
ash15khng

@PDanielY Is it a bug tho?

Profile icon
DynamicSquid
Profile icon
Purple01Flame

@DynamicSquid Repl.it does not allow msvcrt. That article will not reference or help me.