Hello, all!
The problem is:
How could a running function be killed from the upper level?
Here is an example:
Pressing the button starts a function that runs 10 times, asking each time for a new text, if you press "OK".
The point is : how could I, after the "Cancel" is pressed kill the running function "get_text" (from the function-context of the function "type_it") without killing the whole process? I mean so that the "."-window didn´t disappear.
The problem is:
How could a running function be killed from the upper level?
Here is an example:
Code:
proc type_it {} {
global var
toplevel .top
set var ""
label .top.lab1 -text "Enter your text here :"
entry .top.ent -bg white -width 14 -textvariable var
button .top.b1 -text "OK" -command "destroy .top"
button .top.b2 -text "Cancel" -command "destroy .top"
grid .top.ent -columnspan 2
grid .top.b1 .top.b2
tkwait window .top
return $var
}
proc get_text {wid} {
for {set i 0} {$i<10} {incr i} {
$wid configure -text [type_it]
update idletasks
}
}
label .lab -text "You have entered : "
label .lab2 -text ""
button .but -text "Enter something..." -command "get_text .lab2"
grid .lab .lab2
grid .but -columnspan 2
Pressing the button starts a function that runs 10 times, asking each time for a new text, if you press "OK".
The point is : how could I, after the "Cancel" is pressed kill the running function "get_text" (from the function-context of the function "type_it") without killing the whole process? I mean so that the "."-window didn´t disappear.