|
26 | 26 | """ |
27 | 27 | from html.parser import HTMLParser |
28 | 28 | from os.path import abspath, dirname, isfile, join |
29 | | -from tkinter import Toplevel, Frame, Text, Scrollbar, Menu, Menubutton |
| 29 | +from tkinter import Toplevel, Frame, Text, Menu |
| 30 | +from tkinter.ttk import Menubutton, Scrollbar |
30 | 31 | from tkinter import font as tkfont |
31 | 32 | from idlelib.config import idleConf |
32 | 33 |
|
33 | | -use_ttk = False # until available to import |
34 | | -if use_ttk: |
35 | | - from tkinter.ttk import Menubutton |
36 | | - |
37 | 34 | ## About IDLE ## |
38 | 35 |
|
39 | 36 |
|
@@ -196,15 +193,18 @@ class HelpFrame(Frame): |
196 | 193 | "Display html text, scrollbar, and toc." |
197 | 194 | def __init__(self, parent, filename): |
198 | 195 | Frame.__init__(self, parent) |
199 | | - text = HelpText(self, filename) |
| 196 | + # keep references to widgets for test access. |
| 197 | + self.text = text = HelpText(self, filename) |
200 | 198 | self['background'] = text['background'] |
201 | | - scroll = Scrollbar(self, command=text.yview) |
| 199 | + self.toc = toc = self.toc_menu(text) |
| 200 | + self.scroll = scroll = Scrollbar(self, command=text.yview) |
202 | 201 | text['yscrollcommand'] = scroll.set |
| 202 | + |
203 | 203 | self.rowconfigure(0, weight=1) |
204 | 204 | self.columnconfigure(1, weight=1) # text |
205 | | - self.toc_menu(text).grid(column=0, row=0, sticky='nw') |
206 | | - text.grid(column=1, row=0, sticky='nsew') |
207 | | - scroll.grid(column=2, row=0, sticky='ns') |
| 205 | + toc.grid(row=0, column=0, sticky='nw') |
| 206 | + text.grid(row=0, column=1, sticky='nsew') |
| 207 | + scroll.grid(row=0, column=2, sticky='ns') |
208 | 208 |
|
209 | 209 | def toc_menu(self, text): |
210 | 210 | "Create table of contents as drop-down menu." |
@@ -265,7 +265,7 @@ def show_idlehelp(parent): |
265 | 265 | if not isfile(filename): |
266 | 266 | # try copy_strip, present message |
267 | 267 | return |
268 | | - HelpWindow(parent, filename, 'IDLE Help') |
| 268 | + return HelpWindow(parent, filename, 'IDLE Help') |
269 | 269 |
|
270 | 270 | if __name__ == '__main__': |
271 | 271 | from idlelib.idle_test.htest import run |
|
0 commit comments