77enclosing block. The number of hint lines is determined by the maxlines
88variable in the codecontext section of config-extensions.def. Lines which do
99not open blocks are not shown in the context hints pane.
10+
11+ For EditorWindows, <<toggle-code-context>> is bound to CodeContext(self).
12+ toggle_code_context_event.
1013"""
1114import re
1215from sys import maxsize as INFINITY
1316
14- import tkinter
17+ from tkinter import Frame , Text , TclError
1518from tkinter .constants import NSEW , SUNKEN
1619
1720from idlelib .config import idleConf
@@ -83,7 +86,7 @@ def __del__(self):
8386 if self .t1 is not None :
8487 try :
8588 self .text .after_cancel (self .t1 )
86- except tkinter . TclError : # pragma: no cover
89+ except TclError : # pragma: no cover
8790 pass
8891 self .t1 = None
8992
@@ -111,7 +114,7 @@ def toggle_code_context_event(self, event=None):
111114 padx += widget .tk .getint (info ['padx' ])
112115 padx += widget .tk .getint (widget .cget ('padx' ))
113116 border += widget .tk .getint (widget .cget ('border' ))
114- context = self .context = tkinter . Text (
117+ context = self .context = Text (
115118 self .editwin .text_frame ,
116119 height = 1 ,
117120 width = 1 , # Don't request more than we get.
@@ -127,7 +130,7 @@ def toggle_code_context_event(self, event=None):
127130
128131 line_number_colors = idleConf .GetHighlight (idleConf .CurrentTheme (),
129132 'linenumber' )
130- self .cell00 = tkinter . Frame (self .editwin .text_frame ,
133+ self .cell00 = Frame (self .editwin .text_frame ,
131134 bg = line_number_colors ['background' ])
132135 self .cell00 .grid (row = 0 , column = 0 , sticky = NSEW )
133136 menu_status = 'Hide'
@@ -221,7 +224,7 @@ def jumptoline(self, event=None):
221224 """
222225 try :
223226 self .context .index ("sel.first" )
224- except tkinter . TclError :
227+ except TclError :
225228 lines = len (self .info )
226229 if lines == 1 : # No context lines are showing.
227230 newtop = 1
0 commit comments