MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / HelpFrame

Class HelpFrame

tools/python-3.11.9-amd64/Lib/idlelib/help.py:210–235  ·  view source on GitHub ↗

Display html text, scrollbar, and toc.

Source from the content-addressed store, hash-verified

208
209
210class HelpFrame(Frame):
211 "Display html text, scrollbar, and toc."
212 def __init__(self, parent, filename):
213 Frame.__init__(self, parent)
214 self.text = text = HelpText(self, filename)
215 self.style = Style(parent)
216 self['style'] = 'helpframe.TFrame'
217 self.style.configure('helpframe.TFrame', background=text['background'])
218 self.toc = toc = self.toc_menu(text)
219 self.scroll = scroll = Scrollbar(self, command=text.yview)
220 text['yscrollcommand'] = scroll.set
221
222 self.rowconfigure(0, weight=1)
223 self.columnconfigure(1, weight=1) # Only expand the text widget.
224 toc.grid(row=0, column=0, sticky='nw')
225 text.grid(row=0, column=1, sticky='nsew')
226 scroll.grid(row=0, column=2, sticky='ns')
227
228 def toc_menu(self, text):
229 "Create table of contents as drop-down menu."
230 toc = Menubutton(self, text='TOC')
231 drop = Menu(toc, tearoff=False)
232 for lbl, dex in text.parser.toc:
233 drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
234 toc['menu'] = drop
235 return toc
236
237
238class HelpWindow(Toplevel):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected