Re: wait_window exception

Michael Lange <[email protected]> Tue, 24 Dec 2019 13:59:42 +0100
Newsgroups gmane.comp.python.tkinter
Message-ID <[email protected]>
Hi,

sorry for the late reply.

On Wed, 18 Dec 2019 15:54:04 +0000
Vasilis Vlachoudis <[email protected]> wrote:

> 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.

I am not sure what may be the problem here. What does the close() method
do exactly, is it possible that the problem lies there?

A happy Christmas to all of you!

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

One of the advantages of being a captain is being able to ask for
advice without necessarily having to take it.
		-- Kirk, "Dagger of the Mind", stardate 2715.2