Message359146
Just to add that I realize now that tkinter is designed for applications with a root window, the "application window". That's why little attention is given to a possible missing root. In fact, it's interesting that we have this code in simpledialog.py:
# Here, if parent is None, we have a run time error.
if parent.winfo_viewable():
self.transient(parent)
if title:
self.title(title)
self.parent = parent
self.result = None
body = Frame(self)
self.initial_focus = self.body(body)
body.pack(padx=5, pady=5)
self.buttonbox()
if not self.initial_focus:
self.initial_focus = self
self.protocol("WM_DELETE_WINDOW", self.cancel)
if self.parent is not None:
self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
parent.winfo_rooty()+50))
But, self.parent will never be None. So the geometry always depends on the parent, which is compatible with the view that we are within an application with a root window - there is always a parent.
But it contradicts a bit, in my view, the "simple" in "simpledialog". What about an application with no root window, like git for example, but which, unlike git, needs to create a simple dialog in some occasions? |
|
Date |
User |
Action |
Args |
2020-01-01 06:50:22 | dominic108 | set | recipients:
+ dominic108 |
2020-01-01 06:50:22 | dominic108 | set | messageid: <1577861422.75.0.719265816888.issue39171@roundup.psfhosted.org> |
2020-01-01 06:50:22 | dominic108 | link | issue39171 messages |
2020-01-01 06:50:22 | dominic108 | create | |
|