New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using of simple dialogs without default root window #86887
Comments
Currently, standard message boxes in tkinter.messagebox (like showinfo() or askyesnocancel()) can be called without master or default root window. If arguments master or parent are not specified and there is no default root window is still created, the root window is created and set as the default root window. It is kept visible after closing a message box. It was done for testing from REPL. It affects also tkinter.colorchooser.askcolor(). The drawback is that the root window is kept visible and that it is set as the default root window (so following explicit calls of Tk(), with possible different arguments does not set the default root window). Simple query dialogs in tkinter (like askinteger()) initially had the same behavior. But later it was broken, and currently they do not work if master and parent are not specified and the default root window is not set. Proposed PR improves behavior of message boxes and colorchooser and restore the lost feature for query dialogs. Now if master and parent are not specified and the default root window is not set, the new temporary hidden root window is created, but is not set as the default root window. It will be destroyed right after closing the dialog, so it will not affect other widgets. |
The does not affect IDLE, as the two ask... calls pass parent. (And I may someday replace them with query.Query subclasses.) But I do prefer that tkinter act consistently and sensibly for others. The PR's initial commit message adds this justification for the particular behavior: "It will help to use these simple dialog windows in programs which do Contrary to the message above, temporary root is set as _default_root and the latter is then set back to None. Consequently, there can be no temporary if _default_root cannot be set. Changing this would be messy enough that I think it reasonable to presume and require that people not otherwise needing a GUI will not call no_default_root, or learn to call Tk() if using an installation with patched tkinter. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: