Module Text :: Class Text

Class Text

source code

The Text object

This object gives access to Texts in Blender.

Instance Methods
string
getName()
Get the name of this Text object.
source code
 
setName(name)
Set the name of this Text object.
source code
string
getFilename()
Get the filename of the file loaded into this Text object.
source code
int
getNLines()
Get the number of lines in this Text buffer.
source code
 
clear()
Clear this Text object: its buffer becomes empty.
source code
 
set(attribute, value)
Set this Text's attributes.
source code
 
write(data)
Append a string to this Text buffer.
source code
list of strings
asLines()
Retrieve the contents of this Text buffer as a list of strings.
source code
Instance Variables
bool fakeUser
When set to True, this datablock wont be removed, even if nothing is using it.
  filename
The filename of the file loaded into this Text.
string or None lib
path to the blend file this datablock is stored in (readonly).
  mode
The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
string name
unique name within each blend file.
  nlines
The number of lines in this Text.
IDGroup properties
Returns an IDGroup reference to this datablocks's ID Properties.
bool tag
A temporary tag that to flag data as being used within a loop.
int users
The number of users this datablock has.
Method Details

setName(name)

source code 
Set the name of this Text object.
Parameters:
  • name (string) - The new name.

set(attribute, value)

source code 
Set this Text's attributes.
Parameters:
  • attribute (string) - The attribute to change: currently, 'follow_cursor' is the only one available. It can be turned 'on' with value = 1 and 'off' with value = 0.
  • value (int) - The new attribute value.

write(data)

source code 
Append a string to this Text buffer.
Parameters:
  • data (string) - The string to append to the text buffer.

asLines()

source code 
Retrieve the contents of this Text buffer as a list of strings.
Returns: list of strings
A list of strings, one for each line in the buffer

Instance Variable Details

fakeUser

When set to True, this datablock wont be removed, even if nothing is using it. All data has this disabled by default except for Actions.
Type:
bool

lib

path to the blend file this datablock is stored in (readonly).

lib will be None unless you are using external blend files with (File, Append/Link)

Note: the path may be relative, to get the full path use Blender.sys.expandpath
Type:
string or None

name

unique name within each blend file.

The name is case sensitive and 21 characters maximum length.

Note: a blend file may have naming collisions when external library data is used, be sure to check the value of lib.

Note: Setting a value longer then 21 characters will be shortened
Type:
string

tag

A temporary tag that to flag data as being used within a loop. always set all tags to True or False before using since blender uses this flag for its own internal operations.
Type:
bool

users

The number of users this datablock has. (readonly) Zero user datablocks are de-allocated after reloading and saving.
Type:
int