OUTPUT BUFFER:
#!/usr/local/bin/wish ####!/home/moumou/tcl8.6b1/lubin/bin/wish8.6 #!/usr/local/bin/wish8.4 package require Tkzinc proc Data {{n 100} {l 1000}} { set ll [list A C D E F G H I K L M N P Q R S T V W Y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .] for {set s 0} {$s < $n} {incr s} { set seq "" for {set i 0} {$i < $l} {incr i} { append seq [lindex $ll [expr {round(50*rand())}]] } lappend Lseq $seq } return $Lseq } proc LesLignesDufichier {f} { return [split [ContenuDuFichier $f] \n] } proc ContenuDuFichier {f} { set c [open $f r] set r [read -nonewline $c] close $c return $r } ########################### proc Taggons {Lseq Lnd} { lassign $Lnd nd tmp set sLseq [join $Lseq \n] for {set i 0} {$i < [string length $sLseq]} {incr i} { set x [string index $sLseq $i] if {[regexp {I|L|M|V|F|Y|W|K|R|P|G|N} $x]} { .t tag add T$x $nd $i $nd [expr {$i+1}] } } return } set nseq 300 set lgs 3000 set Xmax [expr {12*($lgs+1)}] set Ymax [expr {16*($nseq+1)}] set Lseq [Data $nseq $lgs] zinc .zc \ -width $Xmax \ -height $Ymax \ -scrollregion [list 0 0 600 300] \ -font "Courier 16 bold" \ -xscrollcommand {.sx set} \ -yscrollcommand {.sy set} scrollbar .sx \ -orient horiz \ -command {.zc xview} scrollbar .sy \ -command {.zc yview} grid .zc -row 0 -column 0 -sticky news grid .sy -row 0 -column 1 -sticky news grid .sx -row 1 -column 0 -sticky ew set Ll [LesLignesDufichier "../etc/table_couleurs.dat"] foreach l [lrange $Ll 1 end] { if {[string index $l 0] eq ">"} {break} lassign $l aa fg bg if {[string length $aa] > 1} {continue} if {[regexp -nocase {forest} $bg]} { set bg "#226b22" } if {[regexp -nocase {cyan} $bg]} { set bg "#00ffff" } if {[regexp -nocase {darkviolet} $bg]} { set bg "#9400d3" } puts "$aa $bg $fg" set Tags(fg,$aa) $fg set Tags(bg,$aa) $bg } set x 0 set y 0 foreach s $Lseq { foreach c [split $s ""] { if {$c ne "."} {set Tg T$c} {set Tg ""} .zc add text 1 -text $c -tags $Tg -position [list $x $y] incr x 16 } set x 0 incr y 16 } foreach a {A C D E F G H I K L M N P Q R S T V W Y} { .zc configure -backcolor [set Tags(bg,$a)] .zc itemconfigure T$a -color [set Tags(fg,$a)] } #bind .zc <1> {set nd [%W node -index %x %y] ; puts "node picked : $nd" ; Taggons $Lseq $nd}