[visionegg] Re: copying Text() objects
- From: "Gabriel Nevarez" <nevarezg@xxxxxxxxxxxxx>
- To: <visionegg@xxxxxxxxxxxxx>
- Date: Tue, 22 Mar 2005 17:11:03 +0000
My mistake... seems you *can* do this after all (Previous email was about
unrelated error).
Still, is there any way to copy a text object, or do I have to instantiate a
new copy for each text I want to use, as follows? :
text_color = (0.0,0.0,1.0) # RGB ( blue)
xpos = 10.0
yspace = 5
text_params = {'anchor':'lowerleft','color':text_color,'font_size':20}
text_stimuli = []
ypos = 0
for i in range(10):
text_stimuli.append( Text( text = "object number %d."%(i),
position=(xpos,ypos),**text_params))
ypos += text_stimuli[-1].parameters.size[1] + yspace
my bad....
-=gabe
>>> nevarezg@xxxxxxxxxxxxx 22/03/05 4:51 PM >>>
Hello,
Does anybody know what the best way to make multiple copies of a text object?
copy() and deepcopy() don't seem to work (apparently have trouble copying the
texture once instantiated).
If this isn't possible, is there any simple construct for iteratively
instantiating a new text object without having to name it? This would be ideal
for creating multiple text characters (each being an individual text object).
As such, I have to manually create a distinct text object, assign it to a
unique variable name, then append them in a list.
I've tried the following:
text = []
text.append(Text(text="Hello world!",
color=(1.0,1.0,1.0), # alpha is ignored (set with
max_alpha_param)
position=(0,0),
font_size=50,
font_name = "cour.ttf",
anchor='lowerleft')
)
but I get the following error:
2005-03-22 16:46:02,121 (759) CRITICAL: Traceback (most recent call last):
File "./displaytext.py", line 82, in ?
print "text parameters = ", text.constant_parameters.font_name, \
AttributeError: 'list' object has no attribute 'constant_parameters'
text parameters =
Traceback (most recent call last):
File "./displaytext.py", line 82, in ?
print "text parameters = ", text.constant_parameters.font_name, \
Can I thus assume that a Text() object needs to be assigned to a variable (and
thus cannot be simply stored as a reference in a list structure)?
cheers,
-=Gabriel Nevarez
Research Programmer
Psychology Department
Cardiff University
http://www.cf.ac.uk/psych
=====================================The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
=====================================The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: copying Text() objects
- From: Andrew Straw
Other related posts:
- » [visionegg] copying Text() objects
- » [visionegg] Re: copying Text() objects
- » [visionegg] Re: copying Text() objects
- » [visionegg] Re: copying Text() objects
- [visionegg] Re: copying Text() objects
- From: Andrew Straw