diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-10-17 05:31:35 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-10-17 05:31:35 (GMT) |
commit | cd567365c9f95cf005d6bb7c1da7946b68a43ab4 (patch) | |
tree | f26214676f8957a3e89451cc4cb54239bd5ab113 /Lib/idlelib/ColorDelegator.py | |
parent | 9a6f8e18662c67cd41bf54ef3b8dbf2b7f5a3aeb (diff) | |
download | cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.zip cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.tar.gz cpython-cd567365c9f95cf005d6bb7c1da7946b68a43ab4.tar.bz2 |
Issue #22629: Revise idle_test.htest, mostly docstring. Start revision of
htests to add # htest # marker for coveragepy and stop tcl errors.
Diffstat (limited to 'Lib/idlelib/ColorDelegator.py')
-rw-r--r-- | Lib/idlelib/ColorDelegator.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py index 22bb22f..13a9010 100644 --- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -2,7 +2,6 @@ import time import re import keyword import builtins -from tkinter import * from idlelib.Delegator import Delegator from idlelib.configHandler import idleConf @@ -234,20 +233,23 @@ class ColorDelegator(Delegator): for tag in self.tagdefs: self.tag_remove(tag, "1.0", "end") -def _color_delegator(parent): +def _color_delegator(parent): # htest # + from tkinter import Toplevel, Text from idlelib.Percolator import Percolator - root = Tk() - root.title("Test ColorDelegator") - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - source = "if somename: x = 'abc' # comment\nprint" - text = Text(root, background="white") - text.insert("insert", source) + + top = Toplevel(parent) + top.title("Test ColorDelegator") + top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, + parent.winfo_rooty() + 150)) + source = "if somename: x = 'abc' # comment\nprint\n" + text = Text(top, background="white") text.pack(expand=1, fill="both") + text.insert("insert", source) + text.focus_set() + p = Percolator(text) d = ColorDelegator() p.insertfilter(d) - root.mainloop() if __name__ == "__main__": from idlelib.idle_test.htest import run |