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.
This commit is contained in:
Terry Jan Reedy 2016-06-21 18:41:38 -04:00
parent aacd53f6cb
commit b60adc54d4
15 changed files with 92 additions and 84 deletions

View file

@ -122,21 +122,20 @@ def make_objecttreeitem(labeltext, object, setfunction=None):
return c(labeltext, object, setfunction)
def _object_browser(parent):
def _object_browser(parent): # htest #
import sys
from tkinter import Tk
root = Tk()
root.title("Test debug object browser")
from tkinter import Toplevel
top = Toplevel(parent)
top.title("Test debug object browser")
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 150))
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
top.geometry("+%d+%d"%(x + 100, y + 175))
top.configure(bd=0, bg="yellow")
top.focus_set()
sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
if __name__ == '__main__':
from idlelib.idle_test.htest import run