def item_chosen(button, choice): print(choice) response = urwid.Text([u'Running ', button.label, '\n']) done = menu_button('Ok', show_main_menu) top.pattern_menu(urwid.Filler(urwid.Pile([response, done]))) # run pattern global pattern if pattern.is_alive(): pattern.stop() shytlight.clear_buffer() pattern = choice() pattern.start()
def exit_program(button): if pattern.is_alive(): pattern.stop() shytlight.clear_buffer() raise urwid.ExitMainLoop()