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