I'm making a program where it detects if you have clicked a key on your keyboard. I know you can do:
def show(key):
if key == Key.tab:
print("Click")
with Listener(on_press=show) as listener:
listener.join()
However, I want it to detect a keypress even when the root window isn't selected. For example, let's say I switch my window to Google Chrome. Although the Tkinter window is selected, I want to detect if you were to press 'tab.'