Prev: Checksum
Next: SMTP issue
From: Russell E. Owen on
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.
From: slebetman@yahoo.com on
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.

From: Russell E. Owen on
In article <1141868998.793262.235610(a)u72g2000cwu.googlegroups.com>,
"slebetman(a)yahoo.com" <slebetman(a)gmail.com> wrote:

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

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
From: walton.paul on
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

 | 
Pages: 1
Prev: Checksum
Next: SMTP issue