i want a bot who prints the keys witch are pressed in google chrome youtube (in the search-bar). But the Code works only with keys like space, enter etc and not with 'a', 'b' etc. Here the code:
import win32gui
from pynput import keyboard
def on_press(key):
 try: key_pressed = key.char # single-char keys
 except: key_pressed = key.name # other keys
 print(key_pressed)
 active_window = win32gui.GetWindowText(win32gui.GetForegroundWindow())
 print(active_window)
 
Any Help would be apreceated (my english is not very good). Beacause every time i go on google chrome it dont recognise the keys. Please help-
 
    