#!/bin/sh
#\
exec /mas/vision/bin/hp700/wish4.1 slider
#setenv _RLD_ARGS -ignore_unresolved
#An experiment on emotional response
source ~tpminka/lib/common/util.tcl
load-formats
# 1. Set up initial window.
wm title . "Click on Next to continue"
wm geometry . 2000x1000
wm geometry . +0+0
frame .slider
frame .window
frame .intro
pack .intro
# 2. The pictures used in this experiment are listed in a file index.txt.
cd /mas/vision/projects/TextureHeads.3/AffectPics/images
set i [open index.txt r+]
set f [open ~/file a+]
wm protocol . WM_DELETE_WINDOW {
.window configure -text "I don't want to die"
}
# 3. A procedure for loading the next picture
proc load_picture {} {
upvar i index
upvar f file
set tmp [gets $index]
if [eof $index] {
flush $file
close $index
close $file
destroy .
}
if ![eof $index] {
pack forget .slider
pack .window
image1 blank
.window.b configure -state disabled
update
after 3000
image1 read $tmp
update
after 10000 {.window.b configure -state active}
}
}
proc raise_slider {} {
reset
pack forget .window
pack .slider
return
}
# 4. A proceedure to get the values of the slider bars
# and return them to a file called file. Also resets
# the sliders just before displaying the slider page.
proc reset {} {
upvar 2 f file
set data(valence) [.slider.valence get]
set data(intensity) [.slider.intensity get]
proc search a {
upvar $a data
foreach x [array names data] {
lappend list ($x)
lappend list [set data($x)]
}
return $list
}
puts $file [search data]
flush $file
.slider.valence set 0
.slider.intensity set 0
}
# 5. Create the button and the pictures.
image create photo -height 955
label .window.picture -image image1
image1 read [gets $i]
button .window.b -text Next -command raise_slider
pack .window.picture -side top -in .window
pack .window.b -side bottom -anchor e -in .window
# 6. Create the sliders and the button
frame .slider.pad1
pack .slider.pad1 -pady 125
scale .slider.valence -label "Did you like this picture?" \
-from -3 -to 3 -length 10c -width 0.75c -orient
horizontal \
-tickinterval 1
scale .slider.intensity -label "How intensely did you feel
like/dislike?" \
-from 0 -to 6 -length 10c -width 0.75c -orient
horizontal \
-tickinterval 1
pack .slider.valence .slider.intensity -in .slider -pady 50 -padx 323
frame .slider.pad2
pack .slider.pad2 -pady 149
button .slider.b -text Next -command load_picture
pack .slider.b -side bottom -anchor e -in .slider
# 7. Introduction page.
text .intro.text -font -*-helvetica-bold-r-normal-*-*-200-*-*-*-*-*-*
.intro.text insert end "You are about to see a series of
pictures.
Look at each picture for approximatley 20 seconds before clicking on
the \"Next\" button to continue. Following each photo you will be
asked
to rate how much you \"liked\" the picture, and
how \"intensely\" you felt
that response.
You have a right to privacy. Your name will not be released.
If at any time you want to discontinue the experiment, or if at the
conclusion you wish that your data be retracted from the experiment,
simply mention it to the experimenter.
Click on \"I Agree\" to continue."
pack .intro.text
proc accept {} {
pack forget .intro
pack .window
}
button .intro.b -text ``I Agree'' -command accept
pack .intro.b -side bottom -anchor e -in .intro
bind .intro.b <Button-2> {
exit
}
bind .window.b <Button-2> {
exit
}