Posted to tcl by schelte at Thu Aug 20 13:53:00 GMT 2026view pretty

$txtfield tag configure link -foreground blue

proc tags {} {
    set pos [$::txtfield search -regexp -all -count len {!([a-zA-Z]+)} 1.0]
    foreach start $pos num $len {
        set end [$::txtfield index "$start + $num chars"]
        $::txtfield tag add link $start $end
        $::txtfield tag add link[incr link] $start $end
        $::txtfield tag bind link$link <1> [list printlink %W link$link]
    }
}

proc printlink {t link} {
    set name [$t get $link.first $link.last]
    puts $name
}