Dominic Mayers <[email protected]> added the comment:
Again, I just spent a few minutes looking at this, but in the ttk module, in a
similar situation, they do:
if master is None:
if tkinter._support_default_root:
master = tkinter._default_root or tkinter.Tk()
else:
raise RuntimeError(
"No master specified and tkinter is "
"configured to not support default root")
Why not do the same for _QueryDialog in simpledialog.py? Actually, I would also
withdraw the root that was just created, because the user doesn't expect this
extra window. So, I would replace
if not parent:
parent = tkinter._default_root
with
if parent is None:
if tkinter._default_root:
parent = tkinter._default_root
elif tkinter._support_default_root
parent = tkinter.Tk()
parent.withdraw()
else:
raise RuntimeError(
"No parent specified and tkinter is "
"configured to not support default root")
This tries to get a parent, if possible, and provides a more useful message
when no parent can be found, just as in the ttk module in a similar situation.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39171>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com