Module Text

Module Text

source code

The Blender.Text submodule.

Text Objects

This module provides access to Text objects in Blender.

Example:
       import Blender
       from Blender import Text
       #
       txt = Text.New("MyText")          # create a new Text object
       print Text.Get()                  # current list of Texts in Blender
       txt.write("Appending some ")      # appending text
       txt.write("text to my\n")         # '\n' inserts new-line markers
       txt.write("text buffer.")
       print txt.asLines()               # retrieving the buffer as a list of lines
       Text.unlink(txt)                  # removing a Text object


Classes
  Text
This object gives access to Texts in Blender.
Functions
Blender Text
New(name=None, follow_cursor=0)
Create a new Text object.
source code
Blender Text or a list of Blender Texts
Get(name=None)
Get the Text object(s) from Blender.
source code
Blender Text
Load(filename)
Load a file into a Blender Text object.
source code
 
unlink(textobj)
Unlink (remove) the given Text object from Blender.
source code
Function Details

New(name=None, follow_cursor=0)

source code 
Create a new Text object.
Parameters:
  • name (string) - The Text name.
  • follow_cursor (int) - The text follow flag: if 1, the text display always follows the cursor.
Returns: Blender Text
The created Text Data object.

Get(name=None)

source code 
Get the Text object(s) from Blender.
Parameters:
  • name (string) - The name of the Text object.
Returns: Blender Text or a list of Blender Texts
It depends on the 'name' parameter:
  • (name): The Text object with the given name;
  • (): A list with all Text objects in the current scene.

Load(filename)

source code 
Load a file into a Blender Text object.
Parameters:
  • filename (string) - The name of the file to load.
Returns: Blender Text
A Text object with the contents of the loaded file.

unlink(textobj)

source code 
Unlink (remove) the given Text object from Blender.
Parameters:
  • textobj (Blender Text) - The Text object to be deleted.