Implementation of a simple keyboard in Python