Guest_imported
New member
- Jan 1, 1970
- 0
In a tcl program, I have the following function:
proc getIpAddress {} {
global w,Ip_Address
set w .ip_retriever
catch {destroy $w}
toplevel $w
wm resizable $w 0 0
wm transient $w .
label $w.heading -text " Enter IP address "
entry $w.ip_entry -width 18 -textvariable address
frame $w.spaceframe -height 5 -borderwidth 1
button $w.ok_button -text "OK" -command {set Ip_Address $address;
destroy $w}
pack $w.heading $w.ip_entry $w.spaceframe $w.ok_button -side top
}
When I click the "OK" button, the window isn't destroyed and I get an error:
can't read "w": no such variable
while executing
"destroy $w"
Can someone tell me where I went wrong?
proc getIpAddress {} {
global w,Ip_Address
set w .ip_retriever
catch {destroy $w}
toplevel $w
wm resizable $w 0 0
wm transient $w .
label $w.heading -text " Enter IP address "
entry $w.ip_entry -width 18 -textvariable address
frame $w.spaceframe -height 5 -borderwidth 1
button $w.ok_button -text "OK" -command {set Ip_Address $address;
destroy $w}
pack $w.heading $w.ip_entry $w.spaceframe $w.ok_button -side top
}
When I click the "OK" button, the window isn't destroyed and I get an error:
can't read "w": no such variable
while executing
"destroy $w"
Can someone tell me where I went wrong?