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.

Function Summary

Blender Text or a list of Blender Texts

Get(name)

Get the Text object(s) from Blender.

Blender Text

Load(filename)

Load a file into a Blender Text object.

Blender Text

New(name, follow_cursor)

Create a new Text object.

 

unlink(textobj)

Unlink (remove) the given Text object from Blender.

Function Details

Get(name=None)

Get the Text object(s) from Blender.

Parameters:

name - The name of the Text object.

           (type=string)

Returns:

It depends on the 'name' parameter:

  • (name): The Text object with the given name;

  • (): A list with all Text objects in the current scene.

           (type=Blender Text or a list of Blender Texts)

Load(filename)

Load a file into a Blender Text object.

Parameters:

filename - The name of the file to load.

           (type=string)

Returns:

A Text object with the contents of the loaded file.

           (type=Blender Text)

New(name=None, follow_cursor=0)

Create a new Text object.

Parameters:

name - The Text name.

           (type=string)

follow_cursor - The text follow flag: if 1, the text display always follows the cursor.

           (type=int)

Returns:

The created Text Data object.

           (type=Blender Text)

unlink(textobj)

Unlink (remove) the given Text object from Blender.

Parameters:

textobj - The Text object to be deleted.

           (type=Blender Text)