I am using Python (2.4) and trying to simulate a key press (CTRL, SHIFT). But my python is built into a Media application/framework (From Peavey) that allows me to do very basic coding in Python but does not have the capability to install/import any modules, libraries.
So I can't use any of the libraries/modules for key press such as : Keyboard, pyinput, ctype, Win32, wintype etc.
Is there any way to simulate a Keypress without using "import" at the top of the script?
Thank you in advance...
I have tried the following:
import keyboard # using module keyboard
while True: # making a loop
try: # used try so that if user pressed other than the given key error will not be shown
if keyboard.is_pressed('q'): # if key 'q' is pressed
print('You Pressed A Key!')
break # finishing the loop
else:
pass
except:
break # if user pressed a key other than the given key the loop will break
But when executed, it gives me Error stating:
Traceback (most recent call last):
File "key.py", line 1, in ?
import keyboard # using module keyboard
ImportError: No module named keyboard
And I can't import the library when I use the code in production.