What is the correct way to open a dialog and wait for the window
Typically I am doing the following
on a class subclassed of Toplevel

        # ----------------------------------------------------------------------
        def __init__(self, title=None,
                        master=None,
                        **kw):


                super().__init__(master, class_="FileDialog")
                self.transient(master)
                self.title(title)
                self.protocol("WM_DELETE_WINDOW", self.close)

                # ... all initialization.... etc...


        def show(self):
                self.focus_set()
                try:
                        self.deiconify()
                        self.wait_visibility()
                        self.update_idletasks()
                        self.grab_set()
                except tk.TclError:
                        pass
                self.wait_window()
 
Unfortunately, several times when the system is not very responsive I get a 
traceback
report from my users like
  ...
  File \"/usr/local/flair/lib/bFileDialog.py\", line 361, in show
    self.wait_window()
  File \"/usr/lib64/python3.7/tkinter/__init__.py\", line 642, in wait_window
    self.tk.call(\'tkwait\', \'window\', window._w)
_tkinter.TclError: bad window path name \".!flair.!configdialog3.!opendialog\"


Is there the possibility that the user clicks on the "Ok" or "Cancel" button 
before
the code execution arrives to the wait_window(), so when it is there it gives 
the error message.
Or can be something else that I am missing.

Thanks in advance
Vasilis
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to