Changes
Jump to navigation
Jump to search
Line 415:
Line 415:
− #!/usr/bin/env python+
− # import the rusocsci.buttonbox module+
− from rusocsci import buttonbox +
− # make a buttonbox+
− bb = buttonbox.Buttonbox()+
− # wait for a single button press+
− b = bb.waitButtons()+
− # print the button pressed+
− print("b: {}".format(b)) </nowiki>+
− #!/usr/bin/env python+
− # import psychopy and rusocsci+
− from psychopy import core, visual +
− from rusocsci import buttonbox+
− ## Setup Section+
− win = visual.Window(monitor="testMonitor")+
− bb = buttonbox.Buttonbox()+
− text = visual.TextStim(win, "Press a button on the buttonbox")+
− ## Experiment Section+
− # show text+
− text.draw()+
− win.flip()+
− # wait for response+
− b = bb.waitButtons()+
− # show response+
− text.setText("you pressed: {}".format(b))+
− text.draw()+
− win.flip()+
− core.wait(5)+
− ## Cleanup Section+
− core.quit() </nowiki>+
no edit summary
<nowiki>
<nowiki>
#!/usr/bin/env python
# import the rusocsci.buttonbox module
from rusocsci import buttonbox
# make a buttonbox
bb = buttonbox.Buttonbox()
# wait for a single button press
b = bb.waitButtons()
# print the button pressed
print("b: {}".format(b)) </nowiki>
Example using the Buttonbox in PsychoPy:
Example using the Buttonbox in PsychoPy:
<nowiki>
<nowiki>
#!/usr/bin/env python
# import psychopy and rusocsci
from psychopy import core, visual
from rusocsci import buttonbox
## Setup Section
win = visual.Window(monitor="testMonitor")
bb = buttonbox.Buttonbox()
text = visual.TextStim(win, "Press a button on the buttonbox")
## Experiment Section
# show text
text.draw()
win.flip()
# wait for response
b = bb.waitButtons()
# show response
text.setText("you pressed: {}".format(b))
text.draw()
win.flip()
core.wait(5)
## Cleanup Section
core.quit() </nowiki>
== Matlab Settings ==
== Matlab Settings ==