With a Tcl_SetMainLoop call in Tk 8.4 and migrating
back to 8.3.4, it's time to start testing Tk as
a loadable package. After setting up an
appropriate pkgIndex.tcl file for Tk...
Here's one problem:
$ cat test.tcl
package require Tk
after 10000 {set forever 1}
after 1000 {destroy .}
after 2000 {bell}
vwait forever
$ tclsh test.tcl
bgerror failed to handle background error.
Original error: can't invoke "bell" command:
application has been destroyed
Error in bgerror: can't invoke "option" command:
application has been destroyed
Note that all Tk commands get disabled when the
"." window is destroyed on the theory that the
"application has been destroyed". Inside a wish
event loop, it's true that destroying all windows
exits the application, but a loadable Tk will find
itself running inside other event loops. It needs
to handle that situation better.
Logged In: YES
user_id=72656
There may be some fixes involved, but for the above case
that appears to me more like a documentation point of how
Tk behaves as a package.
Logged In: YES
user_id=80530
rather than argue the merits
of this as a bug, I'll make it
a feature request.
I do think our goal for Tk
should be to make it a
nicely loadable package
suitable for non-wish environments.