In a function on_press(key), if the pressed key is the "Alt Gr" key, then :
type(key) == keyboard._xorg.KeyCode instead of type(key) == keyboard.Key
Thus testing : if (key == keyboard.Key.alt_gr): print("Alt_Gr pressed") # doesn't work.
A work around is testing :
if (str(key) == "<65027>"): print("Alt_Gr pressed")
This works for me, but is not natural
All other keys I tested where OK.
Thank you a lot for this useful work.
P.S.
It would be nice to be able to test the state of the Shift, Ctrl, Alt, Super, Alt Gr keys, at any moment, without having to wait for an event. It would be useful for me in the management of the buttons of a graphic tablet.
In a function on_press(key), if the pressed key is the "Alt Gr" key, then : type(key) == keyboard._xorg.KeyCode instead of type(key) == keyboard.Key Thus testing : if (key == keyboard.Key.alt_gr): print("Alt_Gr pressed") # doesn't work. A work around is testing : if (str(key) == "<65027>"): print("Alt_Gr pressed") This works for me, but is not natural All other keys I tested where OK.
Thank you a lot for this useful work.
P.S. It would be nice to be able to test the state of the Shift, Ctrl, Alt, Super, Alt Gr keys, at any moment, without having to wait for an event. It would be useful for me in the management of the buttons of a graphic tablet.