Tk Source Code

View Ticket
Login
Ticket UUID: 456548
Title: Tk work with non-wish event loops
Type: RFE Version: None
Submitter: dgp Created on: 2001-08-29 14:49:01
Subsystem: None Assigned To: dgp
Priority: 5 Medium Severity:
Status: Open Last Modified: 2003-11-13 06:58:58
Resolution: Remind Closed By: hobbs
    Closed on: 2003-07-18 20:54:54
Description:
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.
User Comments: dgp added on 2003-07-19 05:05:20:
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.

hobbs added on 2001-08-30 06:21:35:
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.