Text(ID)

base classes — bpy_struct, ID

class bpy.types.Text(ID)

Text data-block referencing an external or packed text file

current_character

Index of current character in current line, and also start index of character in selection if one exists

Type:int in [0, inf], default 0, (readonly)
current_line

Current line, and start line of selection if one exists

Type:TextLine, (readonly, never None)
current_line_index

Index of current TextLine in TextLine collection

Type:int in [-inf, inf], default 0
filepath

Filename of the text file

Type:string, default “”, (never None)
is_dirty

Text file has been edited since last save

Type:boolean, default False, (readonly)
is_in_memory

Text file is in memory, without a corresponding file on disk

Type:boolean, default False, (readonly)
is_modified

Text file on disk is different than the one in memory

Type:boolean, default False, (readonly)
lines

Lines of text

Type:bpy_prop_collection of TextLine, (readonly)
select_end_character

Index of character after end of selection in the selection end line

Type:int in [0, inf], default 0, (readonly)
select_end_line

End line of selection

Type:TextLine, (readonly, never None)
use_module

Run this text as a script on loading, Text name must end with “.py”

Type:boolean, default False
use_tabs_as_spaces

Automatically converts all new tabs into spaces

Type:boolean, default False
clear()

clear the text block

write(text)

write text at the cursor location and advance to the end of the text block

Parameters:text (string, (never None)) – New text for this data-block
as_module()
as_string()

Return the text as a string.

from_string(string)

Replace text with this string.

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

Inherited Properties

Inherited Functions

References