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

Type

string, default “”, (never None)

font_size

Font size to use for displaying the text

Type

int in [8, 32], default 0

margin_column

Column number to show right margin at

Type

int in [0, 1024], default 0

replace_text

Text to replace selected text with using the replace tool

Type

string, default “”, (never None)

show_line_highlight

Highlight the current line

Type

boolean, default False

show_line_numbers

Show line numbers next to the text

Type

boolean, default False

show_margin

Show right margin

Type

boolean, default False

Type

boolean, default False

show_region_ui
Type

boolean, default False

show_syntax_highlight

Syntax highlight for scripting

Type

boolean, default False

show_word_wrap

Wrap words if there is not enough horizontal space

Type

boolean, default False

tab_width

Number of spaces to display tabs with

Type

int in [2, 8], default 0

text

Text displayed and edited in this space

Type

Text

top

Top line visible

Type

int in [0, inf], default 0

use_find_all

Search in all text data-blocks, instead of only the active one

Type

boolean, default False

use_find_wrap

Search again from the start of the file when reaching the end

Type

boolean, default False

use_live_edit

Run python while editing

Type

boolean, default False

use_match_case

Search string is sensitive to uppercase and lowercase letters

Type

boolean, default False

use_overwrite

Overwrite characters when typing rather than inserting them

Type

boolean, default False

visible_lines

Amount of lines that can be visible in current editor

Type

int in [-inf, inf], default 0, (readonly)

is_syntax_highlight_supported()

Returns True if the editor supports syntax highlighting for the current text datablock

Return type

boolean

region_location_from_cursor(line, column)

Retrieve the region position from the given line and character position

Parameters
  • line (int in [-inf, inf]) – Line, Line index

  • column (int in [-inf, inf]) – Column, Column index

Returns

Region coordinates

Return type

int array of 2 items in [-1, inf]

classmethod bl_rna_get_subclass(id, default=None)
Parameters

id (string) – The RNA type identifier.

Returns

The RNA type or default when not found.

Return type

bpy.types.Struct subclass

classmethod bl_rna_get_subclass_py(id, default=None)
Parameters

id (string) – The RNA type identifier.

Returns

The class or default when not found.

Return type

type

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 (function) – A function that will be called when the region is drawn. It gets the specified arguments as input.

  • args (tuple) – 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_PIXEL for 2D drawing and POST_VIEW for 3D drawing. In some cases PRE_VIEW can be used. BACKDROP can be used for backdrops in the node editor.

Returns

Handler that can be removed later on.

Return type

object

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.

Inherited Properties

Inherited Functions