expyriment.io.TouchScreenButtonBox¶
-
class
expyriment.io.
TouchScreenButtonBox
(button_fields, stimuli=[], background_stimulus=None)[source]¶ A class implementing a TouchScreenButtonBox.
Methods
-
__init__
(button_fields, stimuli=[], background_stimulus=None)[source]¶ Initialize a touchscreen button box.
Parameters: button_fields : visual Expyriment stimulus or list of stimuli
The button fields defines the area on which a click action will be registered.
stimuli : visual Expyriment stimulus or list of stimuli, optional
Additional visual stimuli that will be presented together with the button fields. Stimuli are plotted on top of the button_fields.
background_stimulus : visual Expyriment stimulus, optional
The background stimulus on which the touschscreen button fields are presented. Importantly, background_stimulus has to have size of the screen.
Notes
Every visual Expyriment stimulus can serve as a touchscreen button field. If the TouchScreenButtonBox is presented, it can be checked for events using the methods ‘check’ and ‘wait’.
Add a touchscreen button fields.
Parameters: button_field : visual Expyriment stimulus
-
add_stimulus
(stimulus)[source]¶ Add additional stimulus
The added stimulus will be presented together with the button fields.
Parameters: stimulus : visual Expyriment stimulus
-
background_stimulus
¶ Getter of background stimulus.
Background stimulus, on which the button fields and the additional stimuli will be presented. (visual Expyriment stimuli)
getter of button fields (list of visual Expyriment stimuli)
-
check
(button_fields=None, check_for_control_keys=True)[source]¶ Check if a button field is clicked.
Parameters: button_fields : Expyriment stimulus or list of stimuli, optional
The button fields that will be checked for.
check_for_control_keys : bool, optional
checks if control key has been pressed (default=True)
Returns: pressed_button_field : Expyriment stimulus or list of stimuli, optional
The button fields that will be checked for.
touch_time : integer
The time when the button was touched. Function might return delayed, because button field comparison (after touch) takes time. The return time is most accurate.
Notes
Don’t forget to show the TouchScreenButtonBox.
-
create
()[source]¶ Create the touchscreen buttonbox.
Prepares the button fields and additional stimuli for fast presentation.
-
last_touch_position
¶ getter for the last touch position (x,y)
-
logging
¶ Getter for logging.
-
set_logging
(onoff)¶ Set logging of this object on or off
Parameters: onoff : bool
set logging on (True) or off (False)
Notes
See also design.experiment.set_log_level fur further information about event logging.
-
stimuli
¶ getter of additional stimuli (list of visual Expyriment stimuli)
-
wait
(duration=None, button_fields=None, check_for_control_keys=True)[source]¶ Wait for a touchscreen button box click.
Parameters: button_fields : Expyriment stimulus or list of stimuli, optional
The button fields that will be checked for.
duration : int, optional
maximal time to wait in ms
Returns: pressed_button_field : Expyriment stimulus or None
the button field defined by a stimulus that has been pressed
rt : int
reaction time
See also
design.experiment.register_wait_callback_function
Notes
Don’t forget to show the TouchScreenButtonBox.
-