SpaceTextEditor(Space)
base classes — bpy_struct, Space
- class bpy.types.SpaceTextEditor(Space)
Text editor space data
- find_text
Text to search for with the find tool (default “”, never None)
- Type:
str
- font_size
Font size to use for displaying the text (in [1, 256], default 0)
- Type:
int
- margin_column
Column number to show right margin at (in [0, 1024], default 0)
- Type:
int
- replace_text
Text to replace selected text with using the replace tool (default “”, never None)
- Type:
str
- show_line_highlight
Highlight the current line (default False)
- Type:
bool
- show_line_numbers
Show line numbers next to the text (default False)
- Type:
bool
- show_margin
Show right margin (default False)
- Type:
bool
(default False)
- Type:
bool
- show_region_ui
(default False)
- Type:
bool
- show_syntax_highlight
Syntax highlight for scripting (default False)
- Type:
bool
- show_word_wrap
Wrap words if there is not enough horizontal space (default False)
- Type:
bool
- tab_width
Number of spaces to display tabs with (in [2, 8], default 0)
- Type:
int
- top
Top line visible (in [0, inf], default 0)
- Type:
int
- use_find_all
Search in all text data-blocks, instead of only the active one (default False)
- Type:
bool
- use_find_wrap
Search again from the start of the file when reaching the end (default False)
- Type:
bool
- use_live_edit
Run Python while editing (default False)
- Type:
bool
- use_match_case
Search string is sensitive to uppercase and lowercase letters (default False)
- Type:
bool
- use_overwrite
Overwrite characters when typing rather than inserting them (default False)
- Type:
bool
- visible_lines
Amount of lines that can be visible in current editor (in [-inf, inf], default 0, readonly)
- Type:
int
- is_syntax_highlight_supported()
Returns True if the editor supports syntax highlighting for the current text data-block
- Return type:
bool
- region_location_from_cursor(line, column)
Retrieve the region position from the given line and character position
- Parameters:
line (int) – Line, Line index (in [-inf, inf])
column (int) – Column, Column index (in [-inf, inf])
- Returns:
Region coordinates (array of 2 items, in [-1, inf])
- Return type:
bpy_prop_array[int]
- classmethod bl_rna_get_subclass(id, default=None, /)
- Parameters:
id (str) – The RNA type identifier.
default (
bpy.types.Struct| None) – The value to return when not found.
- Returns:
The RNA type or default when not found.
- Return type:
- classmethod bl_rna_get_subclass_py(id, default=None, /)
- Parameters:
id (str) – The RNA type identifier.
default (type | None) – The value to return when not found.
- Returns:
The class or default when not found.
- Return type:
type
- classmethod draw_handler_add(callback, args, region_type, draw_type)
Add a new draw handler to this space type. It will be called every time the specified region in the space type will be drawn. Note: All arguments are positional only for now.
- Parameters:
callback (Callable[..., Any]) – A function that will be called when the region is drawn. It gets the specified arguments as input, it’s return value is ignored.
args (tuple[Any, ...]) – Arguments that will be passed to the callback.
region_type (str) – The region type the callback draws in; usually
WINDOW. (bpy.types.Region.type)draw_type (str) – Usually
POST_PIXELfor 2D drawing andPOST_VIEWfor 3D drawing. In some casesPRE_VIEWcan be used.BACKDROPcan be used for backdrops in the node editor.
- Returns:
Handler that can be removed later on.
- Return type:
object
- classmethod draw_handler_remove(handler, region_type)
Remove a draw handler that was added previously.
- Parameters:
handler (object) – The draw handler that should be removed.
region_type (str) – Region type the callback was added to.