Skip to content

Commit e96029f

Browse files
committed
release for MTURKtest
1 parent 9a76406 commit e96029f

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ def ToOut(message, exp, post_urlFULL):
124124
print(blocks)
125125
# Do the get
126126
print('About to get')
127-
#http://44.194.15.202
128-
with open('serverinfo.txt', 'r') as f:
127+
with open(os.path.join(WRK_DIR, 'serverinfo.txt'), 'r') as f:
129128
serverinfo = f.read()
130129

131130
try:

tasks/happy.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from smile.common import *
2+
from smile.scale import scale as s
3+
4+
5+
@Subroutine
6+
def HappyQuest(self, config):
7+
with Parallel():
8+
Label(text="How happy are you at this moment?\nPress F to move left, Press J to move right.",
9+
font_size=s(config.INST_FONT_SIZE),
10+
halign='center',
11+
center_y=exp.screen.center_y + s(300))
12+
sld = Slider(min=-10, max=10, value=0, width=s(config.SLIDER_WIDTH))
13+
Label(text="unhappy", font_size=s(config.INST_FONT_SIZE),
14+
center_x=sld.left, center_y=sld.center_y - s(100))
15+
Label(text="happy", font_size=s(config.INST_FONT_SIZE),
16+
center_x=sld.right, center_y=sld.center_y - s(100))
17+
Label(text='Press Spacebar to lock-in your response.',
18+
top=sld.bottom - s(250), font_size=s(config.INST_FONT_SIZE))
19+
20+
with UntilDone():
21+
with Loop():
22+
ans = KeyPress(keys=config.RESP_KEYS)
23+
with If(ans.pressed == config.RESP_KEYS[0]):
24+
with If(sld.value - config.HAPPY_SPEED <= -10):
25+
UpdateWidget(sld, value=-10)
26+
with Else():
27+
UpdateWidget(sld, value=sld.value - config.HAPPY_SPEED)
28+
with Elif(ans.pressed == config.RESP_KEYS[1]):
29+
with If(sld.value + config.HAPPY_SPEED >= 10):
30+
UpdateWidget(sld, value=10)
31+
with Else():
32+
UpdateWidget(sld, value=sld.value + config.HAPPY_SPEED)
33+
Wait(.05)
34+
with UntilDone():
35+
KeyPress(keys=['SPACEBAR'])
36+
Log(name="happy",
37+
value=sld.value)
38+
39+
40+
41+
if __name__ == "__main__":
42+
import config
43+
44+
exp = Experiment()
45+
46+
HappyQuest(config)
47+
48+
exp.run()

0 commit comments

Comments
 (0)