0

Is there a way to intercept key presses in python? By this I mean, suppose I'm in a notepad document, I want my script to detect the keys that I am pressing while I have notepad open, however I want my script to block the key presses from reaching notepad. I am on windows, using python 3.6.

xX0T1Xx
  • 21
  • 1
  • 4
  • 1
    You can use the `curses` library for that. Check the answer from @vgonisanz at https://stackoverflow.com/questions/32417379/what-is-needed-for-curses-in-python-3-4-on-windows7 for the installation instruction – VietHTran Apr 08 '19 at 02:11
  • How exactly would you do this with curses? Would it be possible for you to pin point me to anything related to this? Thanks! – xX0T1Xx Apr 08 '19 at 02:31
  • curses won't do. You need an automation/keyboard macro binding. The keyboard module might work. – Dan D. Apr 08 '19 at 05:25

0 Answers0