#NEWLINE# def run_interaction( f , args , kwargs ) : #NEWLINE# #INDENT# '\n    Run an interaction function, which may yield FrontEndOperation\n    objects to interact with the front end.\n    ' #NEWLINE# g = f ( * args , ** args ) #NEWLINE# def advance( to_send = None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# op = g . send ( to_send ) #NEWLINE# #UNINDENT# except StopIteration : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# except InteractionError as e : #NEWLINE# #INDENT# ShowModal ( 'Error' , [ widgets . Latex ( e . message ) ] ) . submit ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# op . submit ( advance ) #NEWLINE# #UNINDENT# #UNINDENT# advance ( )