ginevra1971
Programmer
Hello, I have a problem with my tcl program.
At the end of this message there is my program. The bold line causes an error when I try to execute it.
The error is "can't read time, no such variable".
I believe it's a scope problem but I can't solve it.
I'm waiting for a solution. Thanks
proc show {value label} {
tk_messageBox -message $value
$label config -text "new label"
}
proc run_gui {} {
wm withdraw .
set w3 .gui
catch { destroy $w3 }
toplevel $w3
#### frame OK e Cancel ###
frame $w3.frame_button
button $w3.frame_button.ok -text " OK " -command {}
button $w3.frame_button.cancel -text " Cancel " -command "destroy $w3"
pack $w3.frame_button.ok $w3.frame_button.cancel -side left -expand 1 -padx 2m
pack $w3.frame_button -side bottom -fill x -pady 2m
# frame input tempo-stato
set frame_input $w3.frame_input
frame $frame_input
pack $frame_input -side top
set entry_time $frame_input.entry_time
set lab_time $frame_input.lab_time
entry $entry_time -relief sunken -textvariable var_time
label $lab_time
$lab_time config -text Time
button $frame_input.btn_insert -text "Show" -width 10 -command [list show $time $lab_time]
grid $lab_time -row 0 -column 0 -rowspan 1 -columnspan 1 -padx 2m
grid $entry_time -row 1 -column 0 -rowspan 1 -columnspan 1 -padx 2m -pady 1m
grid $frame_input.btn_insert -row 1 -column 2 -rowspan 1 -columnspan 1 -padx 2m -pady 2m
raise $w3
focus "$entry_time"
}
run_gui
At the end of this message there is my program. The bold line causes an error when I try to execute it.
The error is "can't read time, no such variable".
I believe it's a scope problem but I can't solve it.
I'm waiting for a solution. Thanks
proc show {value label} {
tk_messageBox -message $value
$label config -text "new label"
}
proc run_gui {} {
wm withdraw .
set w3 .gui
catch { destroy $w3 }
toplevel $w3
#### frame OK e Cancel ###
frame $w3.frame_button
button $w3.frame_button.ok -text " OK " -command {}
button $w3.frame_button.cancel -text " Cancel " -command "destroy $w3"
pack $w3.frame_button.ok $w3.frame_button.cancel -side left -expand 1 -padx 2m
pack $w3.frame_button -side bottom -fill x -pady 2m
# frame input tempo-stato
set frame_input $w3.frame_input
frame $frame_input
pack $frame_input -side top
set entry_time $frame_input.entry_time
set lab_time $frame_input.lab_time
entry $entry_time -relief sunken -textvariable var_time
label $lab_time
$lab_time config -text Time
button $frame_input.btn_insert -text "Show" -width 10 -command [list show $time $lab_time]
grid $lab_time -row 0 -column 0 -rowspan 1 -columnspan 1 -padx 2m
grid $entry_time -row 1 -column 0 -rowspan 1 -columnspan 1 -padx 2m -pady 1m
grid $frame_input.btn_insert -row 1 -column 2 -rowspan 1 -columnspan 1 -padx 2m -pady 2m
raise $w3
focus "$entry_time"
}
run_gui