def edit_value(self):
        """Edit value of widget on the text editor."""
        ### retrieve edited text: this triggers the
        ### text editor edition session, which returns
        ### the edited text when the user finishes editing
        ### the text (or None, if the user decides to
        ### cancel the operation)

        text = edit_text(
            text=pformat(self.value, width=84),
            font_path=FIRA_MONO_BOLD_FONT_PATH,
            syntax_highlighting="python",
            validation_command=is_python_literal,
        )

        ### if there is an edited text (it is not None)
        ### and it represents a python literal different
        ### from the current value, set such value as the
        ### new one

        if text is not None:

            value = literal_eval(text)
            if value != self.value:
                self.set(value)
Edit value of widget on the text editor.
nodezator/widget/literaldisplay.py