It might be possible to fake this by focusing on a text field and abuse on_gui_text_changed, because text field/box does capture keyboard input unlike anything else the api offers. Comes at the drawback of capturing all keyboard input, so player can't move etc until the field is unfocused.