use PyUserInput to implement keyboard event