Does sombody know how to save the contents of an entry widget. I can save the contets of a text widget but with an entry widget it doesn't work.
This is how I do it with a text widget:
text .branche.t -wrap none
button .branche.menubalk.save -text "save" -command {save}
proc save { } {
set str "branche"
set filename [concat [string range $str 0 2][clock format [clock seconds] -format %d%m%y]]
set data [.branche.t get 1.0 {end -1c}]
set file_types {
{"Text Files" { .txt .TXT} }
{"Tcl Files" { .tcl .TCL .tk .TK} }
{"All Files" * }
}
set filename [tk_getSaveFile -filetypes $file_types -initialdir "C:\\usr\\local\\Temp\\$::uniek" -initialfile $filename -defaultextension .txt]
wm title . $filename
set fileid [open $filename w]
puts -nonewline $fileid $data
close $fileid
}
This is how I do it with a text widget:
text .branche.t -wrap none
button .branche.menubalk.save -text "save" -command {save}
proc save { } {
set str "branche"
set filename [concat [string range $str 0 2][clock format [clock seconds] -format %d%m%y]]
set data [.branche.t get 1.0 {end -1c}]
set file_types {
{"Text Files" { .txt .TXT} }
{"Tcl Files" { .tcl .TCL .tk .TK} }
{"All Files" * }
}
set filename [tk_getSaveFile -filetypes $file_types -initialdir "C:\\usr\\local\\Temp\\$::uniek" -initialfile $filename -defaultextension .txt]
wm title . $filename
set fileid [open $filename w]
puts -nonewline $fileid $data
close $fileid
}