(self, event=None)
return "break"
Toggle code context display.

        If self.context doesn't exist, create it to match the size of the editor
        window text (toggle on).  If it does exist, destroy it (toggle off).
        Return 'break' to complete the processing of the binding.
Toggle code context display.
Toggle code context display .
def toggle_code_context_event(self, event=None):
        """Toggle code context display.

        If self.context doesn't exist, create it to match the size of the editor
        window text (toggle on).  If it does exist, destroy it (toggle off).
        Return 'break' to complete the processing of the binding.
        """
        if self.context is None:
            # Calculate the border width and horizontal padding required to
            # align the context with the text in the main Text widget.
            #
            # All values are passed through getint(), since some
            # values may be pixel objects, which can't simply be added to ints.
            widgets = self.editwin.text, self.editwin.text_frame
            # Calculate the required horizontal padding and border width.
            padx = 0
            border = 0
            for widget in widgets:
                info = (widget.grid_info()
                        if widget is self.editwin.text
                        else widget.pack_info())
                padx += widget.tk.getint(info['padx'])
                padx += widget.tk.getint(widget.cget('padx'))
                border += widget.tk.getint(widget.cget('border'))
            context = self.context = Text(
                self.editwin.text_frame,
                height=1,
                width=1,  # Don't request more than we get.
                highlightthickness=0,
                padx=padx, border=border, relief=SUNKEN, state='disabled')
            self.update_font()
            self.update_highlight_colors()
            context.bind('<ButtonRelease-1>', self.jumptoline)
            # Get the current context and initiate the recurring update event.
            self.timer_event()
            # Grid the context widget above the text widget.
            context.grid(row=0, column=1, sticky=NSEW)

            line_number_colors = idleConf.GetHighlight(idleConf.CurrentTheme(),
                                                       'linenumber')
            self.cell00 = Frame(self.editwin.text_frame,
                                        bg=line_number_colors['background'])
            self.cell00.grid(row=0, column=0, sticky=NSEW)
            menu_status = 'Hide'
        else:
            self.context.destroy()
            self.context = None
            self.cell00.destroy()
            self.cell00 = None
            self.text.after_cancel(self.t1)
            self._reset()
            menu_status = 'Show'
        self.editwin.update_menu_label(menu='options', index='*ode*ontext',
                                       label=f'{menu_status} Code Context')
        return "break"
def toggle_code_context_event ( self , event = None ) : if self . context is None : # Calculate the border width and horizontal padding required to # align the context with the text in the main Text widget. # # All values are passed through getint(), since some # values may be pixel objects, which can't simply be added to ints. widgets = self . editwin . text , self . editwin . text_frame # Calculate the required horizontal padding and border width. padx = 0 border = 0 for widget in widgets : info = ( widget . grid_info ( ) if widget is self . editwin . text else widget . pack_info ( ) ) padx += widget . tk . getint ( info [ 'padx' ] ) padx += widget . tk . getint ( widget . cget ( 'padx' ) ) border += widget . tk . getint ( widget . cget ( 'border' ) ) context = self . context = Text ( self . editwin . text_frame , height = 1 , width = 1 , # Don't request more than we get. highlightthickness = 0 , padx = padx , border = border , relief = SUNKEN , state = 'disabled' ) self . update_font ( ) self . update_highlight_colors ( ) context . bind ( '<ButtonRelease-1>' , self . jumptoline ) # Get the current context and initiate the recurring update event. self . timer_event ( ) # Grid the context widget above the text widget. context . grid ( row = 0 , column = 1 , sticky = NSEW ) line_number_colors = idleConf . GetHighlight ( idleConf . CurrentTheme ( ) , 'linenumber' ) self . cell00 = Frame ( self . editwin . text_frame , bg = line_number_colors [ 'background' ] ) self . cell00 . grid ( row = 0 , column = 0 , sticky = NSEW ) menu_status = 'Hide' else : self . context . destroy ( ) self . context = None self . cell00 . destroy ( ) self . cell00 = None self . text . after_cancel ( self . t1 ) self . _reset ( ) menu_status = 'Show' self . editwin . update_menu_label ( menu = 'options' , index = '*ode*ontext' , label = f'{menu_status} Code Context' ) return "break"