Detect Custom Keys
I want to know if there is a module or a way to detect keys and perform some action when clicked in the python console.
So for example, if I clicked
shift + a, it should give something like
So I should be able to make custom shortcuts. I tried many modules, but none of them seem to be working on replit.
Please let me know if you know of a module or a way to do this in the python console.
For Control + C,
import signal def catch_ctrl_C(sig,frame): # Code here signal.signal(signal.SIGINT, catch_ctrl_C)
Hope this helps.
Have a great day :D
@Aivoybia sorry, i didn't see your comments, I was away from my computer, but I'm good now. Also, I don think the
ctrl + . problem will occur for me, since i'm not doing it in the console, i'm doing it in a webpage. So, I think if you just give me the correct code, it will work on the webpage. Could you do that? Thanks!
import signal # if you want to have custom, control is ctrl (on the keyboard), and for letters, it must be capital. Im pretty sure the abbreaviation for period is prd, idk # wherever it says catch_ctrl_period, change the "period" to somethin else if this doesnt work def catch_ctrl_period(sig,frame): print("Kewl") signal.signal(signal.SIGINT, catch_ctrl_period)