Closed remort closed 3 years ago
In order to stop the loop, you need to tell the Screen to stop playing, not the Scene. The way to do that is through Exceptions. See https://asciimatics.readthedocs.io/en/stable/widgets.html#exceptions for more info and contact_list.py for an example.
Ok, got it. Works for me. Thank you.
Describe the bug If I run program throgh
screen.play([Scene(effects=[Surface(screen=screen)])], repeat=False)
, I can't exit the program by catching the specific keyboardEvent.Surface
implementsEffect
interface.To Reproduce Handling the button press in Surface I tried to do:
It seems that my effect (Surface) stops, and Screen got blank, but program never exits. Pressing any other key once more seems to complete screen.play(), and my program exits then.
Expected behavior Expected behavior is to finish play() after screen is close()d or scene is exit()ed and let program continue to the next command.
I can exit with sys.exit() right from my keyboard handler method of Surface effect, but it looks dirty.
Am I miss something?
System details (please complete the following information):
Additional context