How to Simulate Key Presses in Python
I have been searching the web but have been unable to find ANYTHING that is for Linux and that can type sentences, not just letters. I have a Tkinter textbox and I have been trying to find out how to make the program be able to type in the Tkinter textbox. For solutions, I have found things like the SendKeys module but these don't work as they are only for Windows. So if anyone knows how to make python code be able to type in a Tkinter textbox, or know a module that simulates keypresses in python, PLEASE let me know. Thanks!
@Coder100 Traceback (most recent call last):
File "main.py", line 5, in
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pyautogui/init.py", line 242, in
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/mouseinfo/init.py", line 223, in
_display = Display(os.environ['DISPLAY'])
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/Xlib/display.py", line 80, in init
self.display = _BaseDisplay(display)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/Xlib/display.py", line 62, in init
display.Display.init(*(self, ) + args, **keys)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/Xlib/protocol/display.py", line 53, in init
name, host, displayno, screenno = connect.get_display(display)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/Xlib/support/connect.py", line 62, in get_display
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/Xlib/support/unix_connect.py", line 47, in get_display
Xlib.error.DisplayNameError: Bad display name "MAGIC"
@Coder100 When I put it in Tkinter, I got an error when trying to import some modules.
Repl.it: Installing fresh packages
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
WARNING: You are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the '/opt/virtualenvs/python3/bin/python3 -m pip install --upgrade pip' command.
Repl.it: package installation failed!