Hi Experts:
I am trying to do a load the file content from a file in tk. Here is a snippet of my load/save steps:
1) A form to
a)Enter Name:
b) Address:
label .nlabel -text "Enter Name :" -bg lightblue
entry .entry_nlabel -width 40 -textvar Name(Name) -bg pink
label .label_add -text "Enter Address: " -bg lightblue
entry .entry_add -width 25 -textvar Address(Address) -bg pink
load
When run tk program, it automactically load the .save.setting into the field of the entry form so user can check or modify before proceeding to next step.
2)Here is my save/load proc
proc save { } {
global Name
global Address
set fid [open .save.file w]
puts $fid "Name $Name"
puts $fid "Address $Address"
close $fid
}
proce load { } {
global Name
global Address
if { [file exists .save.file] == 1 } {
set OpenID [open .save.file r ]
while { [gets $OpenID line] >= 0} {
switch [lindex $line 0] {
Name { set Name [lrange $line 1 end] }
Address { set Address [lrange $line 1 end] }
}
}
}
3) Content of file(.save.file)
Name Joe
Address 11 Nowhere
When I run this tk program, I got this error
Error in startup script: wrong # args: should be "load fileName ?packageName? ?interp?"
while executing
"load"
What am I doing wrong? Any insight is greatly appreciated.
Thanks in advance.
I am trying to do a load the file content from a file in tk. Here is a snippet of my load/save steps:
1) A form to
a)Enter Name:
b) Address:
label .nlabel -text "Enter Name :" -bg lightblue
entry .entry_nlabel -width 40 -textvar Name(Name) -bg pink
label .label_add -text "Enter Address: " -bg lightblue
entry .entry_add -width 25 -textvar Address(Address) -bg pink
load
When run tk program, it automactically load the .save.setting into the field of the entry form so user can check or modify before proceeding to next step.
2)Here is my save/load proc
proc save { } {
global Name
global Address
set fid [open .save.file w]
puts $fid "Name $Name"
puts $fid "Address $Address"
close $fid
}
proce load { } {
global Name
global Address
if { [file exists .save.file] == 1 } {
set OpenID [open .save.file r ]
while { [gets $OpenID line] >= 0} {
switch [lindex $line 0] {
Name { set Name [lrange $line 1 end] }
Address { set Address [lrange $line 1 end] }
}
}
}
3) Content of file(.save.file)
Name Joe
Address 11 Nowhere
When I run this tk program, I got this error
Error in startup script: wrong # args: should be "load fileName ?packageName? ?interp?"
while executing
"load"
What am I doing wrong? Any insight is greatly appreciated.
Thanks in advance.