Textbox Component¶
This component can be used either to present text to the participant, or to allow free-text answers via the keyboard. It differs from Text Component in that text is wrapped within a container.
- Categories:
Stimuli, Responses
- Works in:
PsychoPy, PsychoJS
Note: Since this is still in beta, keep an eye out for bug fixes.
Parameters¶
Basic¶
The required attributes of the stimulus, controlling its basic function and behaviour
- Name
Everything in a PsychoPy® experiment needs a unique name. The name should contain only letters, numbers and underscores (no punctuation marks or spaces).
- Start
When the Textbox Component should start, see Defining the onset/duration of components.
- Expected start (s)
If you are using frames to control timing of your stimuli, you can add an expected start time to display the component timeline in the routine.
- Start type
How do you want to define your start point?
Options:
time (s)
frame N
condition
- Stop
When the Textbox Component should stop, see Defining the onset/duration of components.
- Expected duration (s)
If you are using frames to control timing of your stimuli, you can add an expected duration to display the component timeline in the routine.
- Stop type
How do you want to define your end point?
Options:
duration (s)
duration (frames)
time (s)
frame N
condition
- Editable?
Should textbox be editable?
- Text
The text to be displayed, see _textboxcomponent-formattingStyle for details on formatting this text (making sections bold, italic, etc.)
- Placeholder text (if :ref:`textboxcomponent-editable` is checked)
Placeholder text to show when there is no text contents.
Layout¶
How should the stimulus be laid out on screen? Padding, margins, size, position, etc.
- Size [w,h]
Size of this stimulus (either a single value or x,y pair, e.g. 2.5, [1,2]).
Note: This is the size of the box, not the text!
- Position [x,y]
Position of this stimulus (e.g. [1,2] )
- Padding
Defines the space between text and the textbox border
- Spatial units
Spatial units for this stimulus (e.g. for its position and size), see Units for the window and stimuli for more info.
Options:
from exp settings
deg
cm
pix
norm
height
degFlatPos
degFlat
- Anchor
Which point in this stimulus should be anchored to the point specified by Position [x,y]?
Options:
center
top-center
bottom-center
center-left
center-right
top-left
top-right
bottom-left
bottom-right
- Orientation
Orientation of this stimulus (in deg)
Options:
-360
360
- Flip horizontal
Whether to mirror-reverse the text horizontally (left-right mirroring)
- Flip vertical
Whether to mirror-reverse the text vertically (top-bottom mirroring)
- Draggable?
Should this stimulus be moveble by clicking and dragging?
- Overflow
If the text is bigger than the textbox, how should it behave?
Options:
visible: Show the overflowing text as it flows past the bottom
scroll: Show a scrollbar to view overflowing text
hidden: Hide overflowing text
Appearance¶
How should the stimulus look? Colors, borders, styles, etc.
- Text color
Color of the text within the box (e.g. $[1,1,0], red )
- Fill color
Fill color of this stimulus (e.g. $[1,1,0], red )
- Border color
Border color of this stimulus (e.g. $[1,1,0], red )
- Color space
In what format (color space) have you specified the colors? See Color spaces for more info.
Options:
rgb
dkl
lms
hsv
- Opacity
Vary the transparency, from 0.0 (invisible) to 1.0 (opaque)
- Border width
Textbox border width
- Contrast
Contrast of the stimulus (1.0=unchanged contrast, 0.5=decrease contrast, 0.0=uniform/no contrast, -0.5=slightly inverted, -1.0=totally inverted)
- Speech point [x,y]
If specified, adds a speech bubble tail going to that point on screen.
Formatting¶
How should this stimulus handle text? Font, spacing, orientation, etc.
- Font
What font should the text be displayed in? Locally, can be a font installed on your computer, saved to the “fonts” folder in your PsychoPy® user folder, or the name of a Google Font. Online, can be any web safe font or a font file added to your resources list in Experiment settings.
- Letter height
The height of the characters in the given units of the stimulus/window. Note that nearly all actual letters will occupy a smaller space than this, depending on font, character, presence of accents etc. The width of the letters is determined by the aspect ratio of the font.
- Line spacing
Defines the space between lines, proportional to the size of the font
- Bold
Should text be bold?
- Italic
Should text be italic?
- Language style
Handle right-to-left (RTL) languages and Arabic reshaping
Options:
LTR
RTL
Arabic
- Formatting style
Syntax to use for inline text formatting (bold, italic, color, etc.).
Options:
- Markdown
Use Markdown with added syntax for color and color spaces:
*italic*= italic**bold**= bold***bold italic***= *bold italic*[color=red]named color[/color]= named color[color=#ff0000]hex color[/color]= hex color[color=(1, -1, -1) space=rgb]other PsychoPy color space[/color]= other PsychoPy color space
To add an asterisk (
*) without it being interpreted as italics, put a\in front of it (\*) to “escape” it.
- HTML (online only)
Use HTML if running online, or a limited subset of HTML if running locally:
<i>italic</i>= italic<b>bold</b>= bold<i><b>bold italic</b></i>= *bold italic*<span style="color:red">named color</span>= named color<span style="color:#ff0000">hex color</span>= hex color
When running locally, any HTML tags which aren’t used (so anything inside
<>characters that isn’t one of the styling options described above) will be hidden, just the inner text will be shown. HTML formatting is only recommended if you are running online and need more advanced formatting options than bold, italic and color.
- No formatting
Don’t do any text formatting, present your text as-is (e.g.
*some italic text*will appear with asterisks and without italics)
- Alignment
How should text be laid out within the box?
Options:
center
top-center
bottom-center
center-left
center-right
top-left
top-right
bottom-left
bottom-right
Data¶
What information about this Component should be saved?
- Save onset/offset times
Store the onset/offset times in the data file (as well as in the log file).
- Sync timing with screen refresh
Synchronize times with screen refresh (good for visual stimuli and responses based on them)
- Auto log
Automatically record all changes to this in the log file
Testing¶
Tools for testing, debugging and checking the performance of this Component.
- Disable Component
Disable this Component
- Validate with…
Name of the Validator Routine to use to check the timing of this stimulus. Options are generated live, so will vary according to your setup.
See also
API reference for TextBox