OUTPUT BUFFER:
#!/usr/local/bin/wish proc SetLabelStyle { w } { global Vrp set style {} lappend style $Vrp(style1) if { $Vrp(styleItalic) } { lappend style italic } if { $Vrp(styleRoman) } { lappend style roman } if { $Vrp(styleUnderline) } { lappend style underline } set Vrp(fontStyle) [join $style " "] set Vrp(font) "$Vrp(fontFamily) $Vrp(fontSize) $Vrp(fontStyle)" $w.c itemconfigure label -font $Vrp(font) } proc SetLabelSize { w size } { global Vrp set Vrp(fontSize) $size set Vrp(font) "$Vrp(fontFamily) $Vrp(fontSize) $Vrp(fontStyle)" $w.c itemconfigure label -font $Vrp(font) } proc SetDotColor { w } { global Vrp set color [tk_chooseColor -title "Choose a dot color" -parent $w \ -initialcolor $Vrp(colDot)] if { ![string compare $color ""] == 0 } { set Vrp(colDot) $color $w.c itemconfigure dot -fill $color } } proc SetLabelColor { w } { global Vrp set color [tk_chooseColor -title "Choose a label color" -parent $w \ -initialcolor $Vrp(colLabel)] if { ![string compare $color ""] == 0 } { set Vrp(colLabel) $color $w.c itemconfigure label -fill $color } } proc ShowLabelevery { w every } { global Vrp set c $w.c for {set i 0 } { $i < $Vrp(Sz) } { incr i $every} { HitPointIndex $c $i } } proc PrintPostscript { w } { global Vrp set initname "unknown.ps" set types { {{Postscript Files} {*.ps}} {{All} {*}} } set ext "ps" set tk_strictMotif 0 set file [tk_getSaveFile -defaultextension $ext \ -initialdir [pwd] \ -filetypes $types \ -initialfile $initname] set tk_strictMotif 1 if {$file != ""} { # remove two object befor printing set c $w.c set reg [$c coords scrollregion] $c delete scrollregion $c delete center $c postscript -file $file -rotate $Vrp(printOrient) #bring them back set item [eval $c create line $reg -fill [$c cget -background] ] $c addtag scrollregion withtag $item ShowCenter $c $Vrp(CX) $Vrp(CY) } } proc SelectSeqInAln { seqNb } { global Vrp if { $seqNb > -1 && $seqNb < $Vrp(NbSeq) } { set seq [join [split $Vrp(Seq,$seqNb) "-"] ""] set seq [join [split $seq "\."] ""] set seq [join [split $seq " "] ""] GenVrpFromData $seq DrawVrp .vrp $Vrp(selectMsg) entryconfigure $Vrp(seqSel) -background {} set Vrp(seqSel) $seqNb $Vrp(selectMsg) entryconfigure $Vrp(seqSel) -background red } } proc DeleteSeqInMenu { } { global Vrp $Vrp(selectMsg) delete 0 end } proc OneSeqLoaded { } { global Vrp $Vrp(selectMsg) add command -label "Only one sequence loaded" \ -command {set t 0} } proc ReadAlnFile { file frmt } { global Vrp set Vrp(File) $file if { [llength $Vrp(File)] > 0 } { DeleteSeqInMenu set in [open $Vrp(File) r] set Vrp(fileType) $frmt switch $frmt { aln { ReadFileAln $in } blc { ReadFileBlc $in } msf { ReadFileMsf $in } } close $in AddSeqNamesToMenu SelectSeqInAln 0 } } proc ReadAlnFileFrmt { frmt } { global Vrp # set Vrp(File) [FSelector .fstmp "" "*.$frmt"] set tk_strictMotif 0 set types {} lappend types [list {Tcl Files} "*\.$frmt"] lappend types [list {All} {*}] ReadAlnFile [tk_getOpenFile -defaultextension $frmt \ -initialdir [pwd] -filetypes $types] $frmt set tk_strictMotif 1 } proc AddSeqNamesToMenu { } { global Vrp set Vrp(seqSel) 0 if { $Vrp(NbSeq) > 0 } { $Vrp(selectMsg) delete 1 $Vrp(NbSeq) } for {set i 0 } { $i < $Vrp(NbSeq)} { incr i } { if { $Vrp(seqSel) == $i } { $Vrp(selectMsg) add command -label $Vrp(Name,$i) \ -underline -1 \ -command "SelectSeqInAln $i" -background red } else { $Vrp(selectMsg) add command -label $Vrp(Name,$i) \ -underline -1 \ -command "SelectSeqInAln $i" } } } proc ReadHydrophb { file } { global VrpC set in [open $file r] set VrpC(NbAA) 0 for {set l [gets $in line] } { ![eof $in ] } { set l [gets $in line] } { set sline [split $line " "] set hx [lindex $sline 1] set hy [lindex $sline 2] set AA1name [lindex $sline 0] set VrpC(HydX,$AA1name) $hx set VrpC(HydY,$AA1name) [expr -$hy] incr VrpC(NbAA) } } proc GenVrpFromData { seq } { global Vrp VrpC set xprev 0.0 set yprev 0.0 set cmx 0.0 set cmy 0.0 set minX $xprev set minY $yprev set maxX $xprev set maxY $yprev set Vrp(seqAA1) $seq set Vrp(seqSS) {} set Vrp(SS) {} set Vrp(AA1) [split $seq ""] set newX {} set newY {} set Vrp(Sz) [llength $Vrp(AA1)] set Vrp(Nb) {} for {set i 0 } { $i < $Vrp(Sz) } { incr i} { set aa [lindex $Vrp(AA1) $i] set hx $VrpC(HydX,$aa) set hy $VrpC(HydY,$aa) set x [expr $Vrp(ScaleOrig)*$hx + $xprev] set y [expr $Vrp(ScaleOrig)*$hy + $yprev] lappend newX $x lappend newY $y lappend Vrp(Nb) [expr $i + 1] set xprev $x set yprev $y set minX [expr "$minX > $x ? $x : $minX"] set minY [expr "$minY > $y ? $y : $minY"] set maxX [expr "$maxX < $x ? $x : $maxX"] set maxY [expr "$maxY < $y ? $y : $maxY"] set cmx [expr $cmx + $x] set cmy [expr $cmy + $y] } set Vrp(X) $newX set Vrp(Y) $newY set Vrp(CmX) [expr $cmx / ($Vrp(Sz)+1)] set Vrp(CmY) [expr $cmy / ($Vrp(Sz)+1)] set Vrp(MinX) $minX set Vrp(MinY) $minY set Vrp(MaxX) $maxX set Vrp(MaxY) $maxY # puts "Min Max in X and Y $Vrp(MinX) $Vrp(MinY) $Vrp(MaxX) $Vrp(MaxY)" set Vrp(SzX) [expr ($Vrp(MaxX) - $Vrp(MinX))/2 ] set Vrp(SzY) [expr ($Vrp(MaxY) - $Vrp(MinY))/2 ] } proc ReadSeqFileFrmt { frmt } { global Vrp set types {} lappend types [list {Seq. Files} "*\.${frmt}*"] lappend types [list {All} {*}] ReadSeqFile [tk_getOpenFile \ -initialdir [pwd] -filetypes $types] $frmt set tk_strictMotif 1 } proc ReadSeqFile { file frmt } { global Vrp set Vrp(NbSeq) 0 set Vrp(File) $file if { [llength $Vrp(File)] > 0 } { set in [open $Vrp(File) r] DeleteSeqInMenu switch $frmt { tfa { ReadFileTfa $in } swi { ReadFileSwiss $in } fle { ReadFileFle $in } } close $in set Vrp(NbSeq) 1 set Vrp(fileType) $frmt OneSeqLoaded DrawVrp .vrp } } proc ReadFileTfa { in } { set LaSeq {} while {[gets $in line]>=0} { if {[regexp ">" $line]} { continue } lappend LaSeq $line } GenVrpFromData [join $LaSeq ""] } proc ReadFileSwiss { in } { set seq {} for {set l [gets $in line] } { ![eof $in ] } { set l [gets $in line] } { if { [regexp {^ [ 0-9]+[ A-Z]+$} $line] } { set sl [string trim $line " 01234567899"] lappend seq [join [split $sl " "] ""] } } GenVrpFromData [join $seq ""] } proc ReadFileFle { in } { global Vrp set i 0 set Vrp(Sz) 0 set Vrp(AA1) {} set Vrp(Nb) {} set Vrp(X) {} set Vrp(Y) {} set Vrp(SS) {} for { set l [gets $in line] } { ![eof $in ] } \ {set l [gets $in line ]} { incr i if { $i <= 7 || $l == 0 } { continue } regsub -all {[ ]+} $line " " v set sline [split $v " "] lappend Vrp(Nb) [lindex $sline 1] lappend Vrp(AA1) [lindex $sline 2] lappend Vrp(X) [lindex $sline 3] lappend Vrp(Y) [expr - [lindex $sline 4]] lappend Vrp(SS) [lindex $sline 5] incr Vrp(Sz) } set Vrp(seqAA1) [join $Vrp(AA1) ""] set Vrp(seqSS) [join $Vrp(SS) ""] GetMinMaxVrp } proc ConfigureVrp { c } { global Vrp set reg [$c coords scrollregion] set border $Vrp(Border) set xmin [expr [lindex $reg 0] - $border] set ymin [expr [lindex $reg 1] - $border] set xmax [expr [lindex $reg 2] + $border] set ymax [expr [lindex $reg 3] + $border] $c configure -scrollregion "$xmin $ymin $xmax $ymax" } proc ScaleRest { w } { global Vrp set c $w.c set invScale [expr 1.0/$Vrp(Scale)] $c scale all $Vrp(CX) $Vrp(CY) $invScale $invScale set Vrp(Scale) 1.0 } proc RemoveAllLabels { w } { $w.c delete label } proc DrawVrp { w } { global Vrp set Vrp(Scale) 1.0 set Vrp(CX) $Vrp(CmX) set Vrp(CY) $Vrp(CmY) set c $w.c $c delete all set cx [expr ($Vrp(MinX) + $Vrp(MaxX))/2.0] set cy [expr ($Vrp(MinY) + $Vrp(MaxY))/2.0] set xprev 0.0 set yprev 0.0 set d $Vrp(DotSz) for {set i 0 } { $i < $Vrp(Sz) } { incr i} { set x [lindex $Vrp(X) $i] set y [lindex $Vrp(Y) $i] $c create line $xprev $yprev $x $y set item [$c create oval [expr $xprev-$d] [expr $yprev-$d] \ [expr $xprev+$d] [expr $yprev+$d] \ -width 1 -outline black \ -fill $Vrp(colDot)] set t [join [concat "p_" $i ] ""] $c addtag $t withtag $item $c addtag "dot" withtag $item set xprev $x set yprev $y } $c raise dot set item [$c create line $Vrp(MinX) $Vrp(MinY) $Vrp(MaxX) $Vrp(MaxY) \ -fill [$c cget -background] ] $c addtag scrollregion withtag $item ShowCenter $c $Vrp(CX) $Vrp(CY) set szx2 [expr $Vrp(Width)/2.0] set szy2 [expr $Vrp(Height)/2.0] $c move all [expr $szx2 - $Vrp(CmX)] [expr $szy2 - $Vrp(CmY)] set Vrp(CX) $szx2 set Vrp(CY) $szy2 ConfigureVrp $c # show the sequence set t $w.text.txt $t configure -state normal $t delete 0.0 end $t insert 1.0 $Vrp(seqAA1) $t configure -height 1 -width 0 -state disabled -insertwidth 0 } proc GetMinMaxVrp { } { global Vrp set xprev 0.0 set yprev 0.0 set cmx 0.0 set cmy 0.0 set minX $xprev set minY $yprev set maxX $xprev set maxY $yprev set newX {} set newY {} for {set i 0 } { $i < $Vrp(Sz) } { incr i} { set x [lindex $Vrp(X) $i] set y [lindex $Vrp(Y) $i] set x [expr $Vrp(ScaleOrig)*$x + $xprev] set y [expr $Vrp(ScaleOrig)*$y + $yprev] lappend newX $x lappend newY $y set xprev $x set yprev $y set minX [expr "$minX > $x ? $x : $minX"] set minY [expr "$minY > $y ? $y : $minY"] set maxX [expr "$maxX < $x ? $x : $maxX"] set maxY [expr "$maxY < $y ? $y : $maxY"] set cmx [expr $cmx + $x] set cmy [expr $cmy + $y] } set Vrp(X) $newX set Vrp(Y) $newY set Vrp(CmX) [expr $cmx / ($Vrp(Sz)+1)] set Vrp(CmY) [expr $cmy / ($Vrp(Sz)+1)] set Vrp(MinX) $minX set Vrp(MinY) $minY set Vrp(MaxX) $maxX set Vrp(MaxY) $maxY # puts "Min Max in X and Y $Vrp(MinX) $Vrp(MinY) $Vrp(MaxX) $Vrp(MaxY)" set Vrp(SzX) [expr ($Vrp(MaxX) - $Vrp(MinX))/2 ] set Vrp(SzY) [expr ($Vrp(MaxY) - $Vrp(MinY))/2 ] } proc itemStartDrag {c x y} { global lastX lastY set lastX $x set lastY $y $c scan mark $x $y } proc itemStartScale {c x y} { global lastX lastY set lastX $x set lastY $y } proc itemScale {c x y} { global lastX lastY Vrp set dx [expr $x - $lastX ] set dy [expr -$y + $lastY ] set max [expr abs($dx) > abs($dy) ? $dx : $dy] if { [expr abs($max)] > 10.0 } { set scale [expr 1.0 + $max/500.0 ] set Vrp(Scale) [ expr $Vrp(Scale) * $scale ] if { $Vrp(Scale) > 0.01 } { $c scale all $Vrp(CX) $Vrp(CY) $scale $scale ConfigureVrp $c } set lastX $x set lastY $y } } proc ShowCenter { c x y } { set cent [$c find withtag center] if { [llength $cent] > 0 } { set crd [$c coords center] $c delete center set x1 [lindex $crd 0] set x2 [lindex $crd 2] set l [expr ($x2 - $x1)/2.0] } else { set l 10 } $c create line [expr $x - $l] $y [expr $x + $l] $y -fill red -tags {center} $c create line $x [expr $y - $l] $x [expr $y + $l] -fill red -tags {center} } proc SetCenter { c x y } { global Vrp set Vrp(CX) [$c canvasx $x] set Vrp(CY) [$c canvasy $y] ShowCenter $c $Vrp(CX) $Vrp(CY) } proc SetCenterOfMass { c } { global Vrp SetCenter $c $Vrp(CmX) $Vrp(CmY) } proc HitPointXY { w x y } { # set c $w.c set t [$c gettags current] for { set i 0 } { $i < [llength $t] } { incr i } { set elt [lindex $t $i] if { [regexp {^p_[0-9]+$} $elt ] } { set item [$c find withtag $elt] set s [split $elt "_"] set j [lindex $s 1] AddRemoveLabel $w $elt } } } proc HitPointIndex { c index } { set elt "p_$index" AddLabel $c $elt $index } proc AddLabel { c elt index } { global Vrp set pos [$c coords $elt] set x1 [lindex $pos 2] set y1 [lindex $pos 3] # add if does not already exist if { [llength [$c find withtag t_$index] ] == 0 } { $c create text $x1 $y1 -fill $Vrp(colLabel) \ -font $Vrp(font) \ -text "[lindex $Vrp(AA1) $index][lindex $Vrp(Nb) $index]" \ -tags "label t_$index" -justify right -anchor sw } } proc AddRemoveLabel { w elt} { global Vrp set t $w.text.txt set c $w.c set index [lindex [split $elt "_"] 1] set item [$c find withtag t_$index] #check if label exists if { [llength $item] == 0 } { # add text AddLabel $c $elt $index } else { $c delete $item } $t see [$t index 1.$index] HighlightChar $t $index } set lastX 0 set lastY 0 set Vrp(gap) "-" set Vrp(CmX) 0 set Vrp(CmY) 0 set Vrp(MinX) 0 set Vrp(MaxX) 0 set Vrp(MinY) 0 set Vrp(MaxY) 0 set Vrp(SzX) 0 set Vrp(SzY) 0 set Vrp(ScaleOrig) 10.0 set Vrp(Nb) {} set Vrp(AA1) {} set Vrp(X) {} set Vrp(Y) {} set Vrp(SS) {} set Vrp(Sz) 0 #Graphic settings #set Vrp(font) {Helvetica 12 normal} set Vrp(fontFamily) Helvetica set Vrp(fontSize) 10 set Vrp(fontStyle) normal set Vrp(font) "$Vrp(fontFamily) $Vrp(fontSize) $Vrp(fontStyle)" set Vrp(style1) normal set Vrp(styleItalic) 0 set Vrp(styleRoman) 0 set Vrp(styleUnderline) 0 set Vrp(Scale) 1.0 set Vrp(CX) 0.0 set Vrp(CY) 0.0 set Vrp(TrX) 0.0 set Vrp(TrY) 0.0 set Vrp(Border) 10.0 set Vrp(File) "test.fle" set Vrp(fileType) fle set Vrp(Height) 400 set Vrp(Width) 700 set Vrp(DotSz) [expr $Vrp(ScaleOrig)/4.0] set Vrp(oldTag) "" set Vrp(oldTag1) "" set Vrp(oldTag2) "" set Vrp(showChar) red set Vrp(oldChar) lightblue set Vrp(BegRes) 0 set Vrp(EndRes) 0 set Vrp(colLabel) red set Vrp(colDot) SkyBlue2 set Vrp(cursor) [. cget -cursor] set Vrp(busyCursor) watch #puts "Vrp(cursor) $Vrp(cursor)" set VrpC(NbAA) 0 set VrpC(HydX,A) 0.0 set VrpC(HydY,A) 0.0 # landscape orientation set Vrp(printOrient) true set Vrp(seqSel) 0 set Vrp(Home) {} catch { set Vrp(Home) $env(VRPHOME) } set Vrp(DataAA) AAtab.dat if { $Vrp(Home) == {} } { puts "" puts "Error : define the environment variable VRPHOME" puts "" exit 1 } #catch {destroy $w} #toplevel $w wm title . "Vrp Show" #wm iconname $w "vrp" set w .vrp #generate the menubar frame .menuBar pack .menuBar -side top -fill x menubutton .menuBar.file -text File -menu .menuBar.file.m -underline 0 menu .menuBar.file.m -tearoff off set seqm .menuBar.file.m.seqm menu $seqm -tearoff off .menuBar.file.m add cascade -label "Open sequence file" -menu $seqm \ -underline 6 $seqm add command -label "\"Fasta\" format" \ -command "ReadSeqFileFrmt tfa" -underline 7 $seqm add command -label "\"Fle\" format" \ -command "ReadSeqFileFrmt fle" -underline 7 $seqm add command -label "\"Swiss\" format" \ -command "ReadSeqFileFrmt swi" -underline 7 set alnm .menuBar.file.m.alnm menu $alnm -tearoff off .menuBar.file.m add cascade -label "Open alignment file" \ -menu $alnm -underline 6 $alnm add command -label "Format Aln (Clustalw)" \ -command "ReadAlnFileFrmt aln" -underline 7 $alnm add command -label "Format Blc (Alscript)" \ -command "ReadAlnFileFrmt blc" -underline 7 $alnm add command -label "Format Msf (GCG)" \ -command "ReadAlnFileFrmt msf" -underline 7 .menuBar.file.m add command -label "Print" -command "PrintPostscript $w" -underline 0 .menuBar.file.m add command -label "Quit" -command "exit" -underline 0 # select the sequence to be represented if more than one is loaded set selectm .menuBar.select.m set Vrp(selectMsg) $selectm menubutton .menuBar.select -text Select -menu $selectm -underline 0 #menu $selectm -tearoff off menu $selectm -tearoff off $selectm add command -label "No sequence loaded" -command {set t 0} # define here the options menubutton .menuBar.option -text Option -menu .menuBar.option.m -underline 0 menu .menuBar.option.m -tearoff off .menuBar.option.m add command -label "Remove labels" -command "RemoveAllLabels $w" -underline 0 .menuBar.option.m add command -label "Scale reset" -command "ScaleRest $w" \ -underline 0 #dot color .menuBar.option.m add command -label "Dot color" -command "SetDotColor $w"\ -underline 0 #label color .menuBar.option.m add command -label "Label color" -command "SetLabelColor $w"\ -underline 0 # define label style set labstm .menuBar.option.m.labst menu $labstm -tearoff off .menuBar.option.m add cascade -label "Set label style" -menu $labstm \ -underline 0 $labstm add radiobutton -label "Normal" -command "SetLabelStyle $w" \ -value normal \ -variable Vrp(style1) $labstm add radiobutton -label "Bold" -command "SetLabelStyle $w" \ -value bold \ -variable Vrp(style1) $labstm add checkbutton -label "Italic" -command "SetLabelStyle $w" \ -variable Vrp(styleItalic) $labstm add checkbutton -label "Underline" -command "SetLabelStyle $w" \ -variable Vrp(styleUnderline) #$labstm add checkbutton -label "Roman" -command "SetLabelStyle $w" \ # -variable Vrp(styleRoman) # define label size set labszm .menuBar.option.m.labsz menu $labszm -tearoff off .menuBar.option.m add cascade -label "Set label size" -menu $labszm \ -underline 0 $labszm add command -label "6" -command "SetLabelSize $w 6" $labszm add command -label "7" -command "SetLabelSize $w 7" $labszm add command -label "8" -command "SetLabelSize $w 8" $labszm add command -label "9" -command "SetLabelSize $w 9" $labszm add command -label "10" -command "SetLabelSize $w 10" $labszm add command -label "12" -command "SetLabelSize $w 12" $labszm add command -label "14" -command "SetLabelSize $w 14" $labszm add command -label "16" -command "SetLabelSize $w 16" $labszm add command -label "18" -command "SetLabelSize $w 18" $labszm add command -label "20" -command "SetLabelSize $w 20" # show labels at regular intervals set labelm .menuBar.option.m.label menu $labelm -tearoff off .menuBar.option.m add cascade -label "Show labels every ..." -menu $labelm \ -underline 0 $labelm add command -label "1 residues" -command "ShowLabelevery $w 1" $labelm add command -label "2 residues" -command "ShowLabelevery $w 2" $labelm add command -label "5 residues" -command "ShowLabelevery $w 5" $labelm add command -label "10 residues" -command "ShowLabelevery $w 10" $labelm add command -label "20 residues" -command "ShowLabelevery $w 20" $labelm add command -label "30 residues" -command "ShowLabelevery $w 30" $labelm add command -label "40 residues" -command "ShowLabelevery $w 40" $labelm add command -label "50 residues" -command "ShowLabelevery $w 50" $labelm add command -label "100 residues" -command "ShowLabelevery $w 100" #set print option set printm .menuBar.option.m.print menu $printm -tearoff off .menuBar.option.m add cascade -label "Print landscape/portrait" -menu $printm \ -underline 0 $printm add radio -label "Portrait orientation" -variable Vrp(printOrient) -value false $printm add radio -label "Landscape orientation" -variable Vrp(printOrient) -value true #---------------------Pack all menu option ------------------------------------ pack .menuBar.file .menuBar.select .menuBar.option -side left #--------------------- start VRP graphics ------------------------------------ frame .vrp pack .vrp -side bottom -expand yes -fill both frame $w.fc pack $w.fc -side top -expand yes -fill both set c $w.c scrollbar $w.vscroll -command "$c yview" scrollbar $w.hscroll -orient horiz -command "$c xview" pack $w.hscroll -in $w.fc -side bottom -fill x pack $w.vscroll -in $w.fc -side right -fill y canvas $c -scrollregion " 0 0 $Vrp(Width) $Vrp(Height)" \ -width $Vrp(Width) -height $Vrp(Height) \ -relief raise -borderwidth 1 \ -xscrollcommand "$w.hscroll set" -yscrollcommand "$w.vscroll set" pack $c -expand yes -in $w.fc -fill both set t $w.text frame $t pack $t -side bottom -expand no -fill x #text $t.txt -xscrollcommand "$t.scroll set" -setgrid true -height 1 -wrap none #scrollbar $t.scroll -orient horiz -command "$t.txt xview" text $t.txt -xscrollcommand "txtScroll $t" -setgrid true -height 1 -wrap none # show residue number begin end label $t.resbeg -text [format "%4d" $Vrp(BegRes)] -width 4 label $t.resend -text [format "%-4d" $Vrp(EndRes)] -width 4 scrollbar $t.scroll -orient horiz -command "scrollTxt $t" pack $t.scroll -side bottom -fill x pack $t.resbeg -side left -fill x pack $t.resend -side right -fill x pack $t.txt -fill x proc txtScroll { t first last } { global Vrp set ts $t.scroll # puts "\nin txtScroll from text $t" set beg [expr $first*$Vrp(Sz)] set end [expr $last*$Vrp(Sz)] set beg [expr int($beg+0.5)] set end [expr int($end+0.5)] if { $beg != $end } { incr beg incr end } $t.resbeg configure -text [format "%4d" $beg] $t.resend configure -text [format "%-4d" $end] $ts set $first $last } proc scrollTxt {t args } { global Vrp set t $t.txt # puts "\n in scrollTxt from scrollbar $t" eval $t xview $args } bind $c <2> "itemStartScale $c %x %y" bind $c