TouchScreenButtonBox usage

3 views
Skip to first unread message

Christophe Pallier

unread,
Nov 19, 2019, 5:18:11 AM11/19/19
to expyriment-users
 Hello,

I am trying to use a TouchScreenButtonBox object.
I am not entirely sure about how to use it.
I tried the code below (see also full script attached), but it blocks on `BB.wait()`, apparently not detecting when I touch any of the picture. What am I doing wrong?

---
img1 =  expyriment.stimuli.Picture("no2.jpg", position=(-200, 100))
img2 =  expyriment.stimuli.Picture("yes2.jpg", position=(200, 100))

BB = expyriment.io.TouchScreenButtonBox([img1, img2])

expyriment.control.start()

img1.present(clear=True, update=False)
img2.present(clear=False, update=True)
button, resptime = BB.wait()
---


no2.jpg
yes2.jpg
touchscreen-test.py

Florian Krause

unread,
Nov 19, 2019, 6:15:38 AM11/19/19
to expyrime...@googlegroups.com
Hi Christophe,

you have to call BB.create() and BB.show() before BB.wait().

Best,
Florian



--
You received this message because you are subscribed to the Google Groups "expyriment-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to expyriment-use...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/expyriment-users/83e2674c-ce80-49d6-b73d-871fb87c40d1%40googlegroups.com.


--
www.fladd.de - Homepage of Florian Krause

Christophe Pallier

unread,
Nov 19, 2019, 7:22:17 AM11/19/19
to expyrime...@googlegroups.com
THANKS!

Now the following code indeed works:

---
img1 = expyriment.stimuli.Picture("no2.jpg", position=(-200, 100))
img2 = expyriment.stimuli.Picture("yes2.jpg", position=(200, 100))

BB = expyriment.io.TouchScreenButtonBox([img1, img2])
BB.create()

expyriment.control.start()

BB.show()
img, resptime = BB.wait()
exp.screen.clear()
exp.screen.update()

exp.clock.wait(2000)
---

--
Christophe Pallier <chris...@pallier.org>
> To view this discussion on the web, visit https://groups.google.com/d/msgid/expyriment-users/CAKAuaqAhy-WkNzEeEDbnOCY6b5APgLkmjhj-LFVuq7ocyTudTw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages