class ShowModal(FrontEndOperation): """ A front end operation that displays a new modal dialog. The result is True if the user clicked OK and False otherwise. Other data entered by the user are available through widgets that populate the modal dialog. """ def __init__(self, title, children): self.modal = ModalWidget(title=title, children=children) self.modal.on_close(self.on_close) def submit(self, on_done=None): self.on_done = on_done display(self.modal) def on_close(self, modal, button): if self.on_done is not None: self.on_done(button == 'OK')
def __init__(self, title, children): self.modal = ModalWidget(title=title, children=children) self.modal.on_close(self.on_close)