Is the bind
in your constructor for the class of the Mac/MncPrj
object? (That's where it needs to be.) If so, it needs to be before the tcl.evalf
call because it defines the variable from the perspective of OTcl; the code to read it won't work (and will generate a Tcl error — an exception in the Tcl level — if you try to do it) until after the binding has been done.
Once you've done the binding, you can read the variable from the Tcl script side with:
Mac/MncPrj set repeatTimes
and write it with:
Mac/MncPrj set repeatTimes $whateverTheValueIs
You should avoid keeping the value in a Tcl array; that'll be a non-live copy and will confuse you. (Unless you get much deeper into the magic of trace add variable
, and that will definitely confuse you. It confuses me sometimes!)