To do so, you’d need a TextStim which would need to be initialized as follows: Now, suppose you would like to welcome my participant by showing a short welcome message - “Welcome to this experiment!”. So, let’s recap: to initialize a component in the Coder interface, we need to (1) import the corresponding class and (2) initialize it with a Window object (in case of visual components) and optionally other arguments that modify the component’s behavior or display. Importantly, all visual stimulus classes (like TextStim, but not Sound) additionally need one (mandatory) argument: a Window object! This allows to TextStim to interact with the window. ![]() We won’t discuss all parameters from every component we discuss in this tutorial you can find all parameters and what they mean in the PsychoPy documentation! For example, to set the font of a text stim to Calibri and the text color to blue, initialize a TextStim object with font='Calibri' and color=(-1, -1, 1). ![]() For example, the color and font properties from text components in the Builder are also available in the Coder interface as arguments (and attributes) of the corresponding component class. Moreover, each component has largely the same properties in the Builder as in the Coder. For example, to add a text component, you can use the TextStim class from the psychopy.visual module and to add a sound component, you can use the Sound component from the psychopy.sound module.īasically, every component from the Builder has an equivalent in the psychopy package. In the coder, however, these components are implemented in different classes from the psychopy package. Like in the Builder, components are the “bread and butter” in the Coder interface as well. ![]() # END BODY OF EXPERIMENT # Finish experiment by closing window and quitting win. " ) # Initialize a fullscreen window with my monitor (HD format) size # and my monitor specification called "samsung" from the monitor center win = Window ( size = ( 1920, 1080 ), fullscr = False, monitor = 'samsung' ) # Also initialize a mouse, for later # We'll set it to invisible for now mouse = Mouse ( visible = False ) # Initialize a (global) clock clock = Clock () # Initialize Keyboard kb = Keyboard () # START BODY OF EXPERIMENT # This is where we'll add stuff from the second # Coder tutorial. From psychopy.gui import DlgFromDict from psychopy.visual import Window from re import Clock, quit, wait from psychopy.event import Mouse from import Keyboard # DIALOG BOX ROUTINE # exp_info =.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |