def main(): global view get_keycodes() gui = Ui.DroidUi() view = Ui.TextView(gui, text = 'Press any key', textSize = '40sp', layout_width = Ui.FILL_PARENT, gravity = Ui.CENTER, ) Ui.Button(gui, text = 'Quit', command = gui.quit) gui.reg_event('key', display_event) gui.mainloop()