(self, event=None)
expand event handler

        This inserts the original text in place of the button in the Text
        widget, removes the button and updates the Squeezer instance.

        If the original text is dangerously long, i.e. expanding it could
        cause a performance degradation, ask the user for confirmation.
expand event handler
expand event handler
def expand(self, event=None):
        """expand event handler

        This inserts the original text in place of the button in the Text
        widget, removes the button and updates the Squeezer instance.

        If the original text is dangerously long, i.e. expanding it could
        cause a performance degradation, ask the user for confirmation.
        """
        if self.is_dangerous is None:
            self.set_is_dangerous()
        if self.is_dangerous:
            confirm = messagebox.askokcancel(
                title="Expand huge output?",
                message="\n\n".join([
                    "The squeezed output is very long: %d lines, %d chars.",
                    "Expanding it could make IDLE slow or unresponsive.",
                    "It is recommended to view or copy the output instead.",
                    "Really expand?"
                ]) % (self.numoflines, len(self.s)),
                default=messagebox.CANCEL,
                parent=self.text)
            if not confirm:
                return "break"

        index = self.text.index(self)
        self.base_text.insert(index, self.s, self.tags)
        self.base_text.delete(self)
        self.editwin.on_squeezed_expand(index, self.s, self.tags)
        self.squeezer.expandingbuttons.remove(self)
def expand ( self , event = None ) : if self . is_dangerous is None : self . set_is_dangerous ( ) if self . is_dangerous : confirm = messagebox . askokcancel ( title = "Expand huge output?" , message = "\n\n" . join ( [ "The squeezed output is very long: %d lines, %d chars." , "Expanding it could make IDLE slow or unresponsive." , "It is recommended to view or copy the output instead." , "Really expand?" ] ) % ( self . numoflines , len ( self . s ) ) , default = messagebox . CANCEL , parent = self . text ) if not confirm : return "break" index = self . text . index ( self ) self . base_text . insert ( index , self . s , self . tags ) self . base_text . delete ( self ) self . editwin . on_squeezed_expand ( index , self . s , self . tags ) self . squeezer . expandingbuttons . remove ( self )