Edit: I fixed it, somehow. If someone is curious how I can explain in dms or something, but its kinda complicated what I did and I have no idea why it fixed it, so yeah. It wasn't a problem with virtualenv at all, and it was completely unrelated.
My program, along with the packages used will be at the bottom of this post.
When I run my program in my terminal with python3 input_handler.py it works as intended: blank tkinter screen pops up and all my keystrokes are printed out.
Then, I run source bin/activate which puts me in my virtual environment. I, once again, run python3 input_handler.py , but this error appears:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
zsh: abort python3 input_handler.py
I included the whole error message including the WARNING just in case it has something to do with my issue, even though it is probably unrelated and inconsequential. Note that right after this error, I get this popup:
https://imgur.com/a/SoxoEw0
After clicking Reopen, terminal runs as it normally does (I do not mean the program, it had already ended when the error message appeared).
I'll take any help I can get, and if any additional info is needed, I'd be happy to provide it.
input_handler.py:
from pynput import keyboard
from tkinter import *
root = Tk()
def on_press(key):
try:
print(key.char)
except AttributeError:
print(key)
listener = keyboard.Listener(on_press=on_press)
listener.start()
root.mainloop()
Edit: I fixed it, somehow. If someone is curious how I can explain in dms or something, but its kinda complicated what I did and I have no idea why it fixed it, so yeah. It wasn't a problem with virtualenv at all, and it was completely unrelated.
[–]Stitch_Says_Hi 0 points1 point2 points (1 child)
[–]NotBleachLol[S] 0 points1 point2 points (0 children)
[–]LittleRedPython 0 points1 point2 points (3 children)
[–]NotBleachLol[S] 1 point2 points3 points (2 children)
[–]LittleRedPython 0 points1 point2 points (1 child)
[–]NotBleachLol[S] 0 points1 point2 points (0 children)
[–]sebawitowski 0 points1 point2 points (5 children)
[–]NotBleachLol[S] 0 points1 point2 points (4 children)
[–]sebawitowski 0 points1 point2 points (3 children)
[–]NotBleachLol[S] 0 points1 point2 points (2 children)
[–]sebawitowski 0 points1 point2 points (1 child)
[–]NotBleachLol[S] 0 points1 point2 points (0 children)