Howdy, Stranger!

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

Supported by

deactivating mouse click to be able to type immediately in form

edited March 26 in OpenSesame

Hello all!

I am trying to make a retrieval test in which I show an image and ask for the associated object. I used the code below, but it requires participants to click first to the box to be able to type the answer. Pilot subjects found it a bit annoying, so is there a way not having to use mouse click and being able to type the answer immediately?

(ps: I saw that it's done by making focus='yes' in other posts, but I think it is not the case anymore).

form = Form(
	cols=[1], rows=[6, 1, 2],
	margins=(50,100,50,100), spacing=25
)
labelQuestion = Label(
	text=u'Which object?',
	center=True
)
image = ImageWidget(path=cur_scene, adjust=True, frame=False)
text_input = TextInput(
		text=u' ', frame=True, center=True, stub ='Type here..',
		return_accepts=True, var=u'response'
)
form.set_widget(labelQuestion, (0,1))
form.set_widget(image, (0, 0))
form.set_widget(text_input, (0, 2))

Comments

  • Hi Irmak,

    The focus=yes approach applies to form_base items, i.e. to OpenSesame script. In your case, you're using Python inline_script, in which case you can accomplish the same thing using the focus_widget keyword when executing the form:

    form._exec(focus_widget=text_input)
    

    Cheers!

    Sebastiaan

    Thanked by 1irmak

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Hi Sebastiaan,

    Thank you very much! You saved me :)

    Best,

    Irmak

Sign In or Register to comment.