I've got this small loop cycle in TCL
for {set i 1} {$i <= $user} {incr i} {
grid [ttk::button .seluser.$i -text "$i" -command { set ::user $i }] -column $i -row 1
}
and I'm getting the message
ERROR can't read "i": no such variable
I think it's because -command works like a new proc and that's why it can not identify the variable i.
I don't know how to do it. Can anybody help me?