Getting a pop up alert to move in Sketchpad
I am new to OS and python and getting support from postgrads and my supervisor. However, after 3 weeks I still don't have what I need in terms of an alert that pops up and either moves up and down slightly (whilst it is there) or is stationary. The other IV is colour contrast. This is where we are with part of the OS run (with help from the others) However, I am not getting anywhere and I need to be at the data capture stage of my project by now.
I should point out that the OS experimental programme itself is not an assessable part of the course it is merely a tool to capture the data.
If you have time could someone suggest what I need to do to get the 'alerts' to move (when needed) Also, am I on the right track with what I've got, or do I need to start again?
Thanks (in desperation!)
Stroller
Comments
@Stroller
I don't know python and am new to OS too, but I took a look at your task and fixed a couple or python code errors that were preventing the task from running. There are two errors It generates some errors to do with code contained in the code of the alert_inline_script. Looking at the error messages in the console and browsing a little about Python on the web, I found the fixes to the two errors coming up:
line 21:
num = '%03d' % random.randrange(001,999)
Problem: You can't have leading zeros in the arguments of the random function (001 must be changed to 1).
Fix:
num = '%03d' % random.randrange(1,999)
line 61:
print resp
Problem: argument needs parentheses
Fix:
print (resp)
With this fixed, the task runs.
Now, I'm not sure I understand what you mean by "an alert that pops up and either moves up and down slightly (whilst it is there) or is stationary". I can't see anything in your code that makes the alert message move once it's displayed. As far as I can tell, your code only sets up the initial display, it doesn't contain instructions to change the position of objects while the trial is running. How long into a trial should that alert move? My guess is that you'd need to use an "if" statement to compare the current time to the time stored in start_time, to define what the new y coordinate of the alert should be, and refresh the canvas then. (or maybe I misunderstood what you are trying to achieve).
Hope that helps a little...
Fabrice.