version 1.2, 1999/10/13 18:45:28
|
version 1.4, 1999/10/20 19:57:37
|
Line 3259 proc createStopButton {} {
|
Line 3259 proc createStopButton {} {
|
if {[winfo exists .stopbutton]} {destroy .stopbutton} |
if {[winfo exists .stopbutton]} {destroy .stopbutton} |
set top [toplevel .stopbutton] |
set top [toplevel .stopbutton] |
button $top.stop -text "Stop Parser" -command "stopParser" |
button $top.stop -text "Stop Parser" -command "stopParser" |
label $top.status -textvariable gStopStatus -width 35 |
label $top.status -textvariable gStopStatus -width 35 -anchor w |
pack $top.stop $top.status |
pack $top.stop $top.status |
set gStopStatus "" |
set gStopStatus "" |
grab $top |
grab $top |
Line 4463 proc analyzeRandom { } {
|
Line 4463 proc analyzeRandom { } {
|
} |
} |
|
|
########################################################### |
########################################################### |
|
# analyzeStrings |
|
########################################################### |
|
########################################################### |
|
########################################################### |
|
proc analyzeStrings { prob window create} { |
|
global gAnalyze |
|
|
|
if { ![winfo exists $window.analyzestrings] } { if {!$create} { return } } |
|
if { ![catch {set setWin [toplevel $window.analyzestrings]}] } { |
|
set msgFrame [frame $setWin.msgFrame] |
|
set valFrame [frame $setWin.valFrame] |
|
set buttonFrame [frame $setWin.buttonFrame] |
|
pack $msgFrame $valFrame $buttonFrame |
|
pack configure $valFrame -expand 1 -fill both |
|
|
|
message $msgFrame.msg -text "Correct Answers" -aspect 3000 |
|
pack $msgFrame.msg |
|
|
|
set maxWidth 1 |
|
foreach choice $gAnalyze($prob.ans) { |
|
if {[string length $choice]>$maxWidth} {set maxWidth [string length $choice]} |
|
} |
|
set maxStringWidth $maxWidth |
|
incr maxWidth 6 |
|
|
|
set selectMode none |
|
listbox $valFrame.val -width [expr $maxWidth + 2] \ |
|
-yscrollcommand "$valFrame.scroll set" -selectmode $selectMode |
|
scrollbar $valFrame.scroll -command "$valFrame.val yview" |
|
pack $valFrame.val $valFrame.scroll -side left |
|
pack configure $valFrame.val -expand 1 -fill both |
|
pack configure $valFrame.scroll -expand 0 -fill y |
|
button $buttonFrame.cancel -text "Dismiss" -command "destroy $setWin" |
|
pack $buttonFrame.cancel |
|
} else { |
|
set maxWidth 1 |
|
set valFrame $window.analyzestrings.valFrame |
|
$valFrame.val delete 0 end |
|
foreach choice $gAnalyze($prob.ans) { |
|
if {[string length $choice]>$maxWidth} {set maxWidth [string length $choice]} |
|
} |
|
set maxStringWidth $maxWidth |
|
incr maxWidth 6 |
|
} |
|
set lastchoice [lindex $gAnalyze($gAnalyze(prob).ans) 0] |
|
set num 1 |
|
foreach choice [lsort $gAnalyze($gAnalyze(prob).ans)] { |
|
if { $lastchoice != $choice } { |
|
$valFrame.val insert end \ |
|
"[format %-[set maxStringWidth]s $lastchoice] [format %5d $num]" |
|
set lastchoice $choice |
|
set num 1 |
|
} else { |
|
incr num |
|
} |
|
} |
|
$valFrame.val insert end \ |
|
"[format %-[set maxStringWidth]s $lastchoice] [format %5d $num]" |
|
} |
|
|
|
########################################################### |
# analyzeUpdate |
# analyzeUpdate |
########################################################### |
########################################################### |
########################################################### |
########################################################### |
Line 4483 proc analyzeUpdate { {newProbNumber 0} }
|
Line 4544 proc analyzeUpdate { {newProbNumber 0} }
|
set gAnalyze(highnum) [set high [lindex $gAnalyze($gAnalyze(prob).ans) end]] |
set gAnalyze(highnum) [set high [lindex $gAnalyze($gAnalyze(prob).ans) end]] |
set gAnalyze(numuniq) [llength [lunique $gAnalyze($gAnalyze(prob).ans)]] |
set gAnalyze(numuniq) [llength [lunique $gAnalyze($gAnalyze(prob).ans)]] |
#don't draw anything if the answers aren't numbers |
#don't draw anything if the answers aren't numbers |
if { [catch {expr $low + 1}]} { update idletask;return } |
if { [catch {expr $low + 1}]} { |
|
catch {destroy $c.button} |
|
update idletask |
|
button $c.button -text "List of strings" -command \ |
|
"analyzeStrings $gAnalyze(prob) $c 1" |
|
$c create window [expr $gAnalyze(canvaswidth)/2.0] 40 -window $c.button |
|
analyzeStrings $gAnalyze(prob) $c 0 |
|
return |
|
} |
|
|
$c create line 25 50 [expr $gAnalyze(canvaswidth) - 25] 50 |
$c create line 25 50 [expr $gAnalyze(canvaswidth) - 25] 50 |
set diff [expr double($high-$low)] |
set diff [expr double($high-$low)] |
if { $diff == 0 } { |
if { $diff == 0 } { |
set center [expr $gAnalyze(canvaswidth)/2.0] |
set center [expr $gAnalyze(canvaswidth)/2.0] |
$c create oval [expr $center - 2] 48 [expr $center + 2] 52 -fill green |
$c create rectangle [expr $center - 2] 48 [expr $center + 2] 52 -fill green |
update idletasks |
update idletasks |
return |
return |
} |
} |
Line 4506 proc analyzeUpdate { {newProbNumber 0} }
|
Line 4575 proc analyzeUpdate { {newProbNumber 0} }
|
set center [expr $center+25] |
set center [expr $center+25] |
$c create rectangle [expr $center - 1] 40 [expr $center + 1] 60 |
$c create rectangle [expr $center - 1] 40 [expr $center + 1] 60 |
} |
} |
|
set lastpoint [lindex $gAnalyze($gAnalyze(prob).ans) 0] |
|
set num 0 |
foreach point $gAnalyze($gAnalyze(prob).ans) { |
foreach point $gAnalyze($gAnalyze(prob).ans) { |
set center [expr ($gAnalyze(canvaswidth)-50)*(($point-$low)/$diff)] |
if { $lastpoint != $point } { |
set center [expr $center+25] |
set center [expr ($gAnalyze(canvaswidth)-50)*(($lastpoint-$low)/$diff)] |
$c create oval [expr $center - 2] 48 [expr $center + 2] 52 -fill green |
set center [expr $center+25] |
|
$c create rectangle [expr $center - 2] [expr 48-$num] \ |
|
[expr $center + 2] [expr 52+$num] -fill green |
|
set lastpoint $point |
|
set num 0 |
|
} else { |
|
incr num |
|
} |
} |
} |
|
set center [expr ($gAnalyze(canvaswidth)-50)*(($lastpoint-$low)/$diff)] |
|
set center [expr $center+25] |
|
$c create rectangle [expr $center - 2] [expr 48-$num] \ |
|
[expr $center + 2] [expr 52+$num] -fill green |
|
|
update idletasks |
update idletasks |
} |
} |