This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dominic108
Recipients dominic108
Date 2019-12-31.22:08:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577830084.53.0.762687499501.issue39171@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-12-31 22:08:04dominic108setrecipients: + dominic108
2019-12-31 22:08:04dominic108setmessageid: <1577830084.53.0.762687499501.issue39171@roundup.psfhosted.org>
2019-12-31 22:08:04dominic108linkissue39171 messages
2019-12-31 22:08:04dominic108create