tk again (question -> solved)
Peter L. Peres
plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Mon Mar 1 20:38:31 UTC 2004
Ok,
it's done. The following code will extract the exact definition of a
canvas object identified by id into script script. Thanks again to Tim
Writer (I was not aware that the structure members in the Tk C data types
appear anywhere in the scripting language - or how):
# create test
set c .c
canvas $c
pack $c
$c create rectangle 10 10 20 20 -fill blue -tags {one two}
# extract data for id 1
set id 1
# do extract and re-create original command
set script [list $c create [$c type $id] [$c coords $id]]
set o [$c itemconfigure $id];
foreach configSpec $o {
# see man Tk_ConfigureInfo
foreach {argvName dbName dbClass defValue curValue} $configSpec {
if {($curValue != "") && ($curValue != $defValue)} {
lappend script $argvName $curValue
}
}
}
# print for testing
puts $script
Peter (thanks again to Tim Writer for pointing the way)
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list