Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tcl/tk on Windows: "This application has requested the Runtime to terminate it in an unusual way" on quit

102 views
Skip to first unread message

Russell E. Owen

unread,
Mar 8, 2006, 4:45:58 PM3/8/06
to
I have an application that uses Tk and runs on various platforms. On
Windows 2000 (I don't know about XP) when the user quits (which calls
quit on the root toplevel), it always exits with the following error
dialog:

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application"s support team for more information.

Any idea how to prevent this? A google search shows that others have had
this problem, but I didn't see any resolution.

-- Russell

P.S. The application need not be doing anything much at the time, though
it does use "after" to run some background tasks.

sleb...@gmail.com

unread,
Mar 8, 2006, 8:49:58 PM3/8/06
to
Russell E. Owen wrote:
> I have an application that uses Tk and runs on various platforms. On
> Windows 2000 (I don't know about XP) when the user quits (which calls
> quit on the root toplevel), it always exits with the following error
> dialog:
>
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application"s support team for more information.

I assume you mean calling the 'exit' command. Otherwise please show us
the proc 'quit' that you've written.

Russell E. Owen

unread,
Mar 10, 2006, 1:30:20 PM3/10/06
to
In article <1141868998.7...@u72g2000cwu.googlegroups.com>,
"sleb...@yahoo.com" <sleb...@gmail.com> wrote:

My program is actually written in Python using its standard tk interface
"Tkinter". Typically Tkinter is a very thin layer over tk, but in this
case it's not a direct translation (probably because Tkinter users must
explicitly start tk's even loop, and quit shuts it down again). The more
typical way to exit any Python program (with or without Tkinter) is to
call sys.exit() and indeed that works just the same (i.e. badly on
Windows) as explicitly quitting Tk's even loop.

I have found one way to get my program to exit gracefully on Windows:
explicitly destroy the root toplevel (a hint found via a google search,
and that came with no explanation) before exiting.

That works, but it's quite slow. One sees each toplevel going away,
rather slowly, one at a time. i suspect tk is recursively destroying the
child widgets. Anyway, my Windows users will just have to live with it.

I'm curious if tcl/tk programmers have seen this -- i.e. can you safely
"exit" from a tcl/tk program on windows if you have multiple toplevels
and some background stuff happening (via "after", not threads)? If so,
this may be a Tkinter bug, not a tk bug.

-- Russell

Gerald W. Lester

unread,
Mar 10, 2006, 4:45:18 PM3/10/06
to

I've used Tcl/Tk on Windows for years and have never seen this error message
-- and have had programs exit via destroying "." as well as calling exit
(both done with multiple toplevels). So, to me it sounds like a Tkinter bug.

P.S. I've also never seen the windows go away slowly when exiting when using
Tcl/Tk.

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+

walto...@gmail.com

unread,
Mar 11, 2006, 4:04:24 AM3/11/06
to
As a workaround, you can withdraw the toplevel windows before they are
destroyed. The program might not exit immediately, but at least it
will disappear immediately.

wm withdraw .window
-or-
wm state .window withdrawn

Cameron Laird

unread,
Mar 11, 2006, 5:08:02 PM3/11/06
to
In article <PrmQf.497342$0l5.130535@dukeread06>,

Gerald W. Lester <Gerald...@cox.net> wrote:
>Russell E. Owen wrote:
>> I'm curious if tcl/tk programmers have seen this -- i.e. can you safely
>> "exit" from a tcl/tk program on windows if you have multiple toplevels
>> and some background stuff happening (via "after", not threads)? If so,
>> this may be a Tkinter bug, not a tk bug.
>>
>> -- Russell
>
>I've used Tcl/Tk on Windows for years and have never seen this error message
>-- and have had programs exit via destroying "." as well as calling exit
>(both done with multiple toplevels). So, to me it sounds like a Tkinter bug.
>
>P.S. I've also never seen the windows go away slowly when exiting when using
>Tcl/Tk.
.
.
.
Me, neither. Nor, for that matter, with the Tkinter
applications I've written.

There's a reasonably active Tkinter mailing list <URL:
http://mail.python.org/mailman/listinfo/tkinter-discuss >
that might profitably take up this question.

0 new messages