Tk Source Code

Artifact [04ddca10]
Login

Artifact 04ddca10946721e998d05e718c199749f8cba28ee6b802c5821944d81320ab23:

Attachment "exercise.tcl" to ticket [7447ed20] added by erikleunissen 2023-05-23 11:35:41. Also attachment "exercise.tcl" to ticket [7447ed20] added by erikleunissen 2023-05-23 11:33:19.
#! /usr/bin/tclsh

package require Tk
pack [frame .f -width 20 -height 20 -bg red]
grab .f

interp create other
interp eval other {
	package require Tk
	pack [frame .f -width 20 -height 20 -bg blue]; # name collision
	wm deiconify .
	set color [tk_chooseColor]
	#
	# Click one of the buttons in the color dialog to receive the error below
	#
}

# grab failed: another application has grab
#     while executing
# "grab $oldGrab"
#     (procedure "::tk::RestoreFocusGrab" line 21)
#     invoked from within
# "::tk::RestoreFocusGrab $w $data(okBtn)"
#     (procedure "::tk::dialog::color::" line 79)
#     invoked from within
# "::tk::dialog::color:: {*}$args"
#     (procedure "tk_chooseColor" line 2)
#     invoked from within
# "tk_chooseColor"
#     invoked from within
# "interp eval other {
#         package require Tk
#         pack [frame .f -width 20 -height 20 -bg blue]; # name collision with the parent interpreter
#         wm deiconify .
#         ..."
#     (file "./exercise.tcl" line 9)