Tuesday, July 26, 2011

Loading a simple tag table

 Here's a quick way of creating multiple tags in one go.

set tagTable {
    {{Header 1} -font {Sans 12 Bold} }
    {{Header 2} -font {Sans 10 Bold} }
    {{Body} -font {Serif 10} -wrapMode word }
}

foreach {a} $tagTable {
    eval "$txt tag create $a"
}

$txt insert end \n
$txt insert end MANTRA\n -tags { {Header 1} }
$txt insert end "Om Ah Hum\n" -tags Body

No comments: