PDA

View Full Version : Multi-line text node


tokola
06-08-2015, 10:53 AM
Is this possible? I couldn't find a way to insert special characters to a text node (e.g. TAB or RETURN).

Thanks!

Jeff
06-08-2015, 11:37 AM
Here's example code that uses the newline character to create multiple lines in a text object:

import viz
viz.go()

gallery = viz.addChild('gallery.osgb')

text = viz.addText('line 1\nline 2\nline 3',parent=viz.SCREEN,pos=[0.5,0.5,0])
text.alignment(viz.ALIGN_CENTER)

tokola
06-08-2015, 01:19 PM
Thanks Jeff. I actually just found it and wanted to post it.
Is there a way to insert other special characters, like TABs?

mape2k
06-10-2015, 04:19 AM
Hello tokola,

didn't you asked the exact same question in another thread just a week ago?

There I stated that using "\t" should insert a tab into your string.

Best,
Johannes

tokola
06-10-2015, 09:15 AM
I am so sorry. You're absolutely right. I totally forgot about it. I think dementia is on the way:)

I'll probably delete one of the two (if possible) to avoid unnecessary clutter of the forum.