![]() (I'm a novice at using ioHub: this works for me but may not be the "correct" way to do it). # regardless of what key is/isn't pressed, apply the current # the key is no longer being pressed, so stop changing the size: If event.type = EventConstants.KEYBOARD_RELEASE: Increment = # make it 1% of screen half-width longer # of the scaling factor to be used until the key is released: This is reported only once, so set the value If event.type = EventConstants.KEYBOARD_PRESS: So if your screen is running at 60 Hz, that is the rate at which the line size will be updated. If you want to obtain key-presses during the wait, be sure to use pyglet and then call () after calling wait () If you want to suppress checking for pyglet events during the wait, do this once: core.checkPygletDuringWait False and from then on you can do: core. Then in the "Each frame" tab, we will check for key presses. Introductions Getting Started with PsychoPy (Part 1) PsychoPy Overview, Stimuli, Input PsychoPy Help 1 Jason Ozubko 977 subscribers Subscribe 511 24K views 1 year ago PsychoPy Help. PsychoPy will be keeping track of various aspects of the stimuli and responses for you throughout the experiment and the key is knowing where to find those. Increment = # initial value of scaling factor Io=launchHubServer(experiment_code='key_evts', psychopy_monitor_name='default') from psychopy.iohub import launchHubServer, EventConstants iolaunchHubServer (experimentcode'keyevts', psychopymonitorname'default') keyboard io.devices.keyboard increment 0, 0 initial value of scaling factor Then in the 'Each frame' tab, we will check for key presses. In the Code component's "Begin Experiment" tab, put this code to initialise ioHub and to create an initial value for the scaling factor that will be applied to the line (defaults to zero): from psychopy.iohub import launchHubServer, EventConstants Now insert a Code component (after it is created, right-click on it and move it above the Line component so that changes to the Line object get applied immediately rather than on the next screen refresh). I assume you have a Line component, and that its size is specified in normalised units. But you can just put the same code snippets at appropriate places within the Coder interface as well. key is, you can use a method like that shown above to find out. This answer assumes you are using PsychoPy's Builder interface. The key functions in psychopy return a list of strings, where each item in the list is.
0 Comments
Leave a Reply. |