Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] using python inline script ; how to get mouse click to move to the next phase

edited August 2014 in OpenSesame

hey all,

i have made a questionnaire using pythons inline script available in open sesame.

at first i was using a next button for the participants to move to the next loop question

my question is how do i get it to move to the next question after selecting their answer from the rating scale without using the next button?

the same way that the form_multiple choice widget works

thanks

bellow is what i have so far

--->

# Import the widgets library
from libopensesame import widgets

# Create a form
form = widgets.form(self.experiment, cols=[1,1,1,1], rows=[1,1,1,1],
    margins=(50,50,50,50), spacing=50)

#QUESTIONS ASKED 
t = self.get('AESQuestions')
AESquestion = widgets.label(form,text=t,center=False)

(#next botton )
(#nextButton = widgets.button(form, text='Next')

#Rating scale
rating_scale = widgets.rating_scale(form, nodes=['Not at all',"Slightly","Somewhat",'A lot'], var='AESrecorded_response')

#position of lable/rating scale 
form.set_widget(AESquestion, (1,0), colspan=3)
form.set_widget(rating_scale, (0,1), colspan=4)
#form.set_widget(nextButton, (0,2), colspan=4)



form._exec()

Comments

  • edited 8:22PM

    Hi!

    This is actually quite easy, you can do so by using the click_accepts keyword. Change your script in the following way:

    # Import the widgets library
    from libopensesame import widgets
    
    # Create a form
    form = widgets.form(self.experiment, cols=[1,1,1,1], rows=[1,1,1,1], margins=(50,50,50,50), spacing=50)
    
    #QUESTIONS ASKED 
    t = self.get('AESQuestions')
    AESquestion = widgets.label(form, text=t, center=False)
    
    #Rating scale
    rating_scale = widgets.rating_scale(form, nodes=['Not at all',"Slightly","Somewhat",'A lot'], click_accepts=True, var='AESrecorded_response')
    
    #position of label/rating scale 
    form.set_widget(AESquestion, (1,0), colspan=3)
    form.set_widget(rating_scale, (0,1), colspan=4)
    
    # run the form
    form._exec()
    

    BTW, a general tip: to make your script look nice and pretty on the forum, but it in between ~ .python and ~ tags.

    Good luck!

Sign In or Register to comment.