[Tkinter-discuss] wait_window exception
Vasilis Vlachoudis
Vasilis.Vlachoudis at cern.ch
Wed Dec 25 12:04:04 EST 2019
Thanks Michael
my best wishes to you too.
The close method is the following, apart some bookkeeping nothing special.
# ----------------------------------------------------------------------
def close(self):
FileDialog._active = False
FileDialog.width = self.winfo_width()
FileDialog.height = self.winfo_height()
FileDialog.sash = [self.fileList.paneframe.sash_coord(i)[0]
for i in range(len(self.fileList.listboxes())-1)]
tkExtra.ExListbox.resetSearch()
self.grab_release()
self.destroy()
I've realized that the "deiconify()" was creating some problems on Windows, so I removed it, and it seems it works better.
When I will deploy this version I will know after if it still generates problems.
Thanks
Vasilis
________________________________________
From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch at python.org] on behalf of Michael Lange [klappnase at web.de]
Sent: Tuesday, December 24, 2019 13:59
To: tkinter-discuss at python.org
Subject: Re: [Tkinter-discuss] wait_window exception
Hi,
sorry for the late reply.
On Wed, 18 Dec 2019 15:54:04 +0000
Vasilis Vlachoudis <Vasilis.Vlachoudis at cern.ch> 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
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
More information about the Tkinter-discuss
mailing list