MCPcopy Index your code
hub / github.com/python/cpython / update_sidebar

Method update_sidebar

Lib/idlelib/sidebar.py:462–486  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

460 self.update_sidebar()
461
462 def update_sidebar(self):
463 text = self.text
464 text_tagnames = text.tag_names
465 canvas = self.canvas
466 line_prompts = self.line_prompts = {}
467
468 canvas.delete(tk.ALL)
469
470 index = text.index("@0,0")
471 if index.split('.', 1)[1] != '0':
472 index = text.index(f'{index}+1line linestart')
473 while (lineinfo := text.dlineinfo(index)) is not None:
474 y = lineinfo[1]
475 prev_newline_tagnames = text_tagnames(f"{index} linestart -1c")
476 prompt = (
477 '>>>' if "console" in prev_newline_tagnames else
478 '...' if "stdin" in prev_newline_tagnames else
479 None
480 )
481 if prompt:
482 canvas.create_text(2, y, anchor=tk.NW, text=prompt,
483 font=self.font, fill=self.colors[0])
484 lineno = get_lineno(text, index)
485 line_prompts[lineno] = prompt
486 index = text.index(f'{index}+1line')
487
488 def yscroll_event(self, *args, **kwargs):
489 """Redirect vertical scrolling to the main editor text widget.

Callers 8

init_widgetsMethod · 0.95
change_callbackMethod · 0.95
runitMethod · 0.80
showpromptMethod · 0.80
on_squeezed_expandMethod · 0.80
reset_shellMethod · 0.80

Calls 6

get_linenoFunction · 0.85
dlineinfoMethod · 0.80
create_textMethod · 0.80
deleteMethod · 0.45
indexMethod · 0.45
splitMethod · 0.45

Tested by 2

reset_shellMethod · 0.64