Howdy, Stranger!

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

Supported by

[solved] how do i get these widgets to record

edited August 2014 in OpenSesame

hey,

ive managed to create a form using inline script.

how do i record their answers and add a next button...?

.. this is what i have so far ,..

from libopensesame import widgets

form = widgets.form(self.experiment, cols=[1,1,1,1], rows=[1,1,1,1,1],
    margins=(50,100,50,100), spacing=25)

labelTitle = widgets.label(form, text='Question')

labelQuestion1 = widgets.label(form,text='Subjects ID',center=False)
labelQuestion2 = widgets.label(form,text='Age',center=False)
labelQuestion3 = widgets.label(form,text='Sex',center=False)
labelQuestion4 = widgets.label(form,text='Parental Education',center=False) 

QA1 = widgets.text_input(form, var='response', return_accepts=True) 
QA2 = widgets.text_input(form, var='response', return_accepts=True) 
QA3 = widgets.text_input(form, var='response', return_accepts=True) 
QA4 = widgets.text_input(form, var='response', return_accepts=True)     

form.set_widget(labelTitle, (0,0), colspan=2)
form.set_widget(labelQuestion1, (0,1), colspan=2)
form.set_widget(labelQuestion2, (0,2), colspan=2)
form.set_widget(labelQuestion3, (0,3), colspan=2)
form.set_widget(labelQuestion4, (0,4), colspan=2)
form.set_widget(QA1, (2,1), colspan=2)
form.set_widget(QA2, (2,2), colspan=2)

checkbox1 = widgets.checkbox(form, text='Male', group='group')
checkbox2 = widgets.checkbox(form, text='Female', group='group')
form.set_widget(checkbox1, (2,3))
form.set_widget(checkbox2, (3,3))
form.set_widget(QA4, (2,4), colspan=2)

# Execute the form! In this case, the form will return the text of the button that
# was clicked. This is one way to get a return value out of the form. Another way
# is to use the 'var' keyword, supported some of the widgets.
Checkbox = form._exec()
text_input = form._exec()

Comments

  • edited 10:13PM

    ok so i got the text widgets to record by includign them ina a loop and logging them as a variable

    how do i do that for the checkbox widget ?

  • edited 10:13PM

    nvm i figured it out

  • edited 10:13PM

    Great, marking this as solved.

Sign In or Register to comment.