9
9
This module provides access to B{Text} objects in Blender.
13
from Blender import Text
15
txt = Text.New("MyText") # create a new Text object
16
print Text.Get() # current list of Texts in Blender
17
txt.write("Appending some ") # appending text
18
txt.write("text to my\\n") # '\\n' inserts new-line markers
19
txt.write("text buffer.")
20
print txt.asLines() # retrieving the buffer as a list of lines
21
Text.unlink(txt) # removing a Text object
13
from Blender import Text
15
txt = Text.New("MyText") # create a new Text object
16
print Text.Get() # current list of Texts in Blender
17
txt.write("Appending some ") # appending text
18
txt.write("text to my\\n") # '\\n' inserts new-line markers
19
txt.write("text buffer.")
20
print txt.asLines() # retrieving the buffer as a list of lines
21
Text.unlink(txt) # removing a Text object
24
24
def New (name = None, follow_cursor = 0):
26
Create a new Text object.
28
@param name: The Text name.
29
@type follow_cursor: int
30
@param follow_cursor: The text follow flag: if 1, the text display always
33
@return: The created Text Data object.
26
Create a new Text object.
28
@param name: The Text name.
29
@type follow_cursor: int
30
@param follow_cursor: The text follow flag: if 1, the text display always
33
@return: The created Text Data object.
36
36
def Get (name = None):
38
Get the Text object(s) from Blender.
40
@param name: The name of the Text object.
41
@rtype: Blender Text or a list of Blender Texts
42
@return: It depends on the 'name' parameter:
43
- (name): The Text object with the given name;
44
- (): A list with all Text objects in the current scene.
38
Get the Text object(s) from Blender.
40
@param name: The name of the Text object.
41
@rtype: Blender Text or a list of Blender Texts
42
@return: It depends on the 'name' parameter:
43
- (name): The Text object with the given name;
44
- (): A list with all Text objects in the current scene.
47
47
def Load (filename):
49
Load a file into a Blender Text object.
50
@type filename: string
51
@param filename: The name of the file to load.
53
@return: A Text object with the contents of the loaded file.
49
Load a file into a Blender Text object.
50
@type filename: string
51
@param filename: The name of the file to load.
53
@return: A Text object with the contents of the loaded file.
56
56
def unlink(textobj):
58
Unlink (remove) the given Text object from Blender.
59
@type textobj: Blender Text
60
@param textobj: The Text object to be deleted.
58
Unlink (remove) the given Text object from Blender.
59
@type textobj: Blender Text
60
@param textobj: The Text object to be deleted.
67
This object gives access to Texts in Blender.
68
@ivar name: The Text name.
69
@ivar filename: The filename of the file loaded into this Text.
70
@ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
71
@ivar nlines: The number of lines in this Text.
76
Get the name of this Text object.
82
Set the name of this Text object.
84
@param name: The new name.
89
Get the filename of the file loaded into this Text object.
95
Get the number of lines in this Text buffer.
101
Clear this Text object: its buffer becomes empty.
104
def set(attribute, value):
106
Set this Text's attributes.
107
@type attribute: string
108
@param attribute: The attribute to change:
109
currently, 'follow_cursor' is the only one available. It can be
110
turned 'on' with value = 1 and 'off' with value = 0.
112
@param value: The new attribute value.
117
Append a string to this Text buffer.
119
@param data: The string to append to the text buffer.
124
Retrieve the contents of this Text buffer as a list of strings.
125
@rtype: list of strings
126
@return: A list of strings, one for each line in the buffer
67
This object gives access to Texts in Blender.
68
@ivar filename: The filename of the file loaded into this Text.
69
@ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
70
@ivar nlines: The number of lines in this Text.
75
Get the name of this Text object.
81
Set the name of this Text object.
83
@param name: The new name.
88
Get the filename of the file loaded into this Text object.
94
Get the number of lines in this Text buffer.
100
Clear this Text object: its buffer becomes empty.
103
def set(attribute, value):
105
Set this Text's attributes.
106
@type attribute: string
107
@param attribute: The attribute to change:
108
currently, 'follow_cursor' is the only one available. It can be
109
turned 'on' with value = 1 and 'off' with value = 0.
111
@param value: The new attribute value.
116
Append a string to this Text buffer.
118
@param data: The string to append to the text buffer.
123
Retrieve the contents of this Text buffer as a list of strings.
124
@rtype: list of strings
125
@return: A list of strings, one for each line in the buffer
129
Text.__doc__ += id_generics.attributes
b'\\ No newline at end of file'