Changes

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

Navigation menu