Running the code below works perfectly on a windows computer. However, when I run it on my MacBook the Key-Release event, canvas.bind_all('<KeyRelease-w>', func)
, returns when w is pressed, not released.
Question: Is there a fixe/workaround inside tkinter or other libraries that comes as standard? I would like to avoid downloading new libraries as pygame or keyboard because I am not allowed to do that on my school computer.
*window (win 10) has python 3.5.2, Mac (Catalina 10.15.6) has python 3.8.5
from tkinter import*
tk = Tk()
canvas = Canvas(tk, width = 100, height = 100)
canvas.pack()
def func(event):
print('Hello')
while True:
canvas.bind_all('<KeyRelease-w>', func)
tk.update()
Edit: According to the comments this is probably a bugg in the Tkinter library. However the question about possible workarounds is still unsolved.