    def _on_close(self, cancelled):
        """
        Method to handle any communication back to the parent widget on closure of this pop-up.

        :param cancelled: Whether the pop-up was cancelled (e.g. by pressing Esc).

        This method can raise an InvalidFields exception to indicate that the current selection is
        invalid and so the pop-up cannot be dismissed.
        """
Method to handle any communication back to the parent widget on closure of this pop-up.

:param cancelled: Whether the pop-up was cancelled (e.g. by pressing Esc).

This method can raise an InvalidFields exception to indicate that the current selection is
invalid and so the pop-up cannot be dismissed.
asciimatics/widgets/temppopup.py