summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/grep.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2016-06-21 22:41:38 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2016-06-21 22:41:38 (GMT)
commitb60adc54d4f248d71d831d14e11cc77fe72c281e (patch)
tree40991b8eacb5eea9cfe04e7dbb2cb20149b868f2 /Lib/idlelib/grep.py
parentaacd53f6cb96fe8c4fe9ce894f22e25f356a97c3 (diff)
downloadcpython-b60adc54d4f248d71d831d14e11cc77fe72c281e.zip
cpython-b60adc54d4f248d71d831d14e11cc77fe72c281e.tar.gz
cpython-b60adc54d4f248d71d831d14e11cc77fe72c281e.tar.bz2
Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled.
Fix code and tests that fail with this restriction. Fix htests to not create a second and redundant root and mainloop.
Diffstat (limited to 'Lib/idlelib/grep.py')
-rw-r--r--Lib/idlelib/grep.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/idlelib/grep.py b/Lib/idlelib/grep.py
index 28132a8..6324b4f 100644
--- a/Lib/idlelib/grep.py
+++ b/Lib/idlelib/grep.py
@@ -3,7 +3,6 @@ import fnmatch
import re # for htest
import sys
from tkinter import StringVar, BooleanVar, Checkbutton # for GrepDialog
-from tkinter import Tk, Text, Button, SEL, END # for htest
from idlelib import searchengine
from idlelib.searchbase import SearchDialogBase
# Importing OutputWindow fails due to import loop
@@ -132,13 +131,14 @@ class GrepDialog(SearchDialogBase):
def _grep_dialog(parent): # htest #
from idlelib.pyshell import PyShellFileList
- root = Tk()
- root.title("Test GrepDialog")
+ from tkinter import Toplevel, Text, Button, SEL, END
+ top = Toplevel(parent)
+ top.title("Test GrepDialog")
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
- root.geometry("+%d+%d"%(x, y + 150))
+ top.geometry("+%d+%d"%(x, y + 150))
- flist = PyShellFileList(root)
- text = Text(root, height=5)
+ flist = PyShellFileList(top)
+ text = Text(top, height=5)
text.pack()
def show_grep_dialog():
@@ -146,9 +146,8 @@ def _grep_dialog(parent): # htest #
grep(text, flist=flist)
text.tag_remove(SEL, "1.0", END)
- button = Button(root, text="Show GrepDialog", command=show_grep_dialog)
+ button = Button(top, text="Show GrepDialog", command=show_grep_dialog)
button.pack()
- root.mainloop()
if __name__ == "__main__":
import unittest