I can easily set multiline text in pyglet.text.Label(), for example
import pyglet
window = pyglet.window.Window(600,400)
label = pyglet.text.Label('The pyglet Programming Guide provides in-depth
documentation for writing applications that use pyglet. Many topics
described here reference the pyglet API reference, provided separately.' ,
width = 500,x = 100, y = 300,multiline=True)
@window.event
def on_draw():
window.clear()
label.draw()
pyglet.app.run()
however, I want set the text in multi-format, but failed, how to modify it ?
import pyglet
window = pyglet.window.Window(600,400)
document = pyglet.text.document.FormattedDocument('The pyglet Programming
Guide provides in-depth documentation for writing applications that use
pyglet. Many topics described here reference the pyglet API reference,
provided separately.')
document.set_style(0,100,dict(color = (255,255,255,255), multiline=True))
document.set_paragraph_style(0,100,dict(align = 'center', margin_left =
'100', margin_right = '100'))
layout = pyglet.text.layout.TextLayout(document,0,0)
layout.x = 100
layout.y = 100
@window.event
def on_draw():
window.clear()
layout.draw()
pyglet.app.run()
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.