7
7
enclosing block. The number of hint lines is determined by the maxlines
8
8
variable in the codecontext section of config-extensions.def. Lines which do
9
9
not 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.
10
13
"""
11
14
import re
12
15
from sys import maxsize as INFINITY
13
16
14
- import tkinter
17
+ from tkinter import Frame , Text , TclError
15
18
from tkinter .constants import NSEW , SUNKEN
16
19
17
20
from idlelib .config import idleConf
@@ -83,7 +86,7 @@ def __del__(self):
83
86
if self .t1 is not None :
84
87
try :
85
88
self .text .after_cancel (self .t1 )
86
- except tkinter . TclError : # pragma: no cover
89
+ except TclError : # pragma: no cover
87
90
pass
88
91
self .t1 = None
89
92
@@ -111,7 +114,7 @@ def toggle_code_context_event(self, event=None):
111
114
padx += widget .tk .getint (info ['padx' ])
112
115
padx += widget .tk .getint (widget .cget ('padx' ))
113
116
border += widget .tk .getint (widget .cget ('border' ))
114
- context = self .context = tkinter . Text (
117
+ context = self .context = Text (
115
118
self .editwin .text_frame ,
116
119
height = 1 ,
117
120
width = 1 , # Don't request more than we get.
@@ -127,7 +130,7 @@ def toggle_code_context_event(self, event=None):
127
130
128
131
line_number_colors = idleConf .GetHighlight (idleConf .CurrentTheme (),
129
132
'linenumber' )
130
- self .cell00 = tkinter . Frame (self .editwin .text_frame ,
133
+ self .cell00 = Frame (self .editwin .text_frame ,
131
134
bg = line_number_colors ['background' ])
132
135
self .cell00 .grid (row = 0 , column = 0 , sticky = NSEW )
133
136
menu_status = 'Hide'
@@ -221,7 +224,7 @@ def jumptoline(self, event=None):
221
224
"""
222
225
try :
223
226
self .context .index ("sel.first" )
224
- except tkinter . TclError :
227
+ except TclError :
225
228
lines = len (self .info )
226
229
if lines == 1 : # No context lines are showing.
227
230
newtop = 1
0 commit comments