[solved] Rating_scale widget showing tickmarks
Dear all,
this is my first post of this kind, so please excuse any mistakes or imprecise descriptions of the problem etc.
I have a problem using the Rating_scale widget in a custom form using python inline scripting.
this is the code for the whole form:
# Creating form
# Margins are defined as "top;right;bottom;left". Each value corresponds to a
# margin in pixels.
form = widgets.form(self.experiment, cols=[1,1,1,1,1,1], rows=[6,1,1,1],
margins=(20, 70, 20, 50), spacing=3)
# Creating widgets
face = widgets.image(form, path=self.experiment.get_file(self.get('pic')))
criterion = widgets.label(form, text = self.get('criterion'))
garnicht = widgets.label(form, text = 'gar nicht '+ self.get('criterion'), center = False)
extrem = widgets.label(form, text = 'extrem ' + self.get('criterion'), center = False)
ratingscale = widgets.rating_scale(form, nodes=['1', '2', '3', '4', '5', '6', '7', '8', '9 '], var = 'response', click_accepts=True)
# Adding widgets to form
form.set_widget(face, (0,0), colspan=6)
form.set_widget(criterion, (2,1), colspan = 2)
form.set_widget(garnicht, (0,2), colspan =1)
form.set_widget(extrem, (5,2), colspan=1)
form.set_widget(ratingscale, (0,3), colspan= 6)
# Executing form
form._exec()
i.e. there is an image file from a list of images 'pic' which needs to be rated according to the criterion 'criterion' on a scale from 1 to 9.
It works well, but I still need the following properties for the experiment which I don't know how to implement:
1) after clicking on one of the boxes, a tickmark should appear and 1000 ms later the form Closes
2) if no response is given, the form closes after 5000 ms
If I use the code as posted, I can implement "2)" using a sort of delay script. The main problem in that case is not seeing a tickmark and closing the form with a set delay after the subject has decided. I only have a tickmark appearing if I choose the option click_accepts =False in my Rating_scale widget, but this leads the form to not close of course.
I know that I could use an additional button to address the tickmark issue, but I would really like to avoid that, since there will be a lot of ratings to be given.
I hope the problem is clear and thank you in advance for any tipps.!:)
Comments
Hi Anne,
Never having worked with forms myself, I tried to find out if there was anything to regulate timing-related things like these, but I'm not sure yet. @Sebastiaan, do you have an answer here?
If not, we would have to work with inline_scripts instead - but let's await Sebastiaan's answer first!
Cheers,
Josh
Hi Anne,
This doesn't sound to hard.
The tickmark is not shown in your case, because the form is immediately closed when the participant ticks a box. However, if you add a 1000 ms delay after the form, you should see the tickbox appearing.
This is only possible with OpenSesame 3.0, which is currently in testing. If you feel adventurous, you can download a pre-release of 3.0.0, and use the new
timeout
keyword. The documentation is not updated to reflect this yet, but you can pass a timeout keyword towidgets.form
, like so:See also:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Dear Sebastiaan and Josh,
so sorry for not replying any earlier. I never got notified again that anyone replied so I thought my question was somehow lost.
Thank you for your replies. I tried using version 3.0 but none of my experiments run and I get heaps of Errors I didn't get before.
I found a solution which involves cheating and I guess is not very elegant. It does the trick, though. It completely relies on inline-scripting. Maybe it can still be of use to anyone even though it is not very pretty.
The general idea is to only render the form, then getting the position of the mouse click, then rendering a form of the same built but this time with a default that corresponds to the value that was clicked. It works well, but of course it is a bit of a pain to get the x and y position of each box.
I hope the dropbox link works:
https://www.dropbox.com/sh/92vj64zmajcejrp/AAAf9fV8bIkeJtkF1pQmXC1ha?dl=0
I hope it helps someone!
Hi Anne,
Great that you worked out a solution; and yes, I would've gone for inline_scripts as well. Although coding may be a pain in the behind at times, in the end it grants you nearly endless freedom!
Cheers,
Josh
Hey Josh,
yes, it's pretty rewarding. Hope to gradually transit to nearly only coding. It's a rocky road
Let me know if you have a more elegant solution than the one I uploaded.
Best,
Anne
Hi Anne,
Could you try the latest 3.0.2 prerelease to see if you can run your experiment? There was a problem with non-ascii characters in forms, but it should be resolved now:
The goal is to have OpenSesame 3.0 run old experiments without any problem, but there are still some kinks to be worked out. You could help by posting a detailed description of any problems that you run into when running old experiments (i.e. things that worked before but don't work anymore).
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!