File: textbox.rst

package info (click to toggle)
psychopy 2023.2.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 124,456 kB
  • sloc: python: 126,213; javascript: 11,982; makefile: 152; sh: 120; xml: 9
file content (84 lines) | stat: -rw-r--r-- 2,213 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
:class:`TextBox`
-----------------

.. warning::

    TextBox is deprecated. Please use :class:`~psychopy.visual.TextBox2` instead which supports similar
    editable high-performance rendering of text but also supports non-monospaced
    fonts and a wider range of formatting and alignment options.

Attributes
==========

.. currentmodule:: psychopy.visual

.. autosummary::

    TextBox

**The following `set______()` attributes all have equivalent `get______()`
attributes:**

.. autosummary::

    TextBox.setText
    TextBox.setPosition
    TextBox.setHorzAlign
    TextBox.setVertAlign
    TextBox.setHorzJust
    TextBox.setVertJust
    TextBox.setFontColor
    TextBox.setBorderColor
    TextBox.setBackgroundColor
    TextBox.setTextGridLineColor
    TextBox.setTextGridLineWidth
    TextBox.setInterpolated
    TextBox.setOpacity
    TextBox.setAutoLog
    TextBox.draw

**TextBox also provides the following read-only functions:**

.. autosummary::

    TextBox.getSize
    TextBox.getName
    TextBox.getDisplayedText
    TextBox.getValidStrokeWidths
    TextBox.getLineSpacing
    TextBox.getGlyphPositionForTextIndex
    TextBox.getTextGridCellPlacement

Helper Functions
================

**getFontManager()**

`FontManager` provides a simple API for finding and loading font files (.ttf)
via the FreeType library.

The FontManager finds supported font files on the computer and initially creates
a dictionary containing the information about available fonts. This can be used
to quickly determine what font family names are available on the computer and
what styles (bold, italic) are supported for each family.

This font information can then be used to create the resources necessary to
display text using a given font family, style, size, color, and dpi.

The `FontManager` is currently used by the psychopy.visual.TextBox stim type. A
user script can access the `FontManager` via::

    font_mngr=visual.textbox.getFontManager()

Once a font of a given size and dpi has been created; it is cached by the
`FontManager` and can be used by all `TextBox` instances created within the
experiment.


Details
=======

.. autoclass:: TextBox
    :members:
    :undoc-members:
    :inherited-members: