I couldn't get any info regarding this field (property) in
pyglet.text.Label.
In fact, I want to be able to obtain the number of lines in a Label
with multiline = True. I thought I could find those by using the
Label.document property but I didn't find any documentation about it
in the API.
Right now, the code is the following (working perfectly except on
cases where I have more lines and multiline enabled):
class HLabel(HPanel):
def __init__(self, batch, x, y, w, h, bcolor = (200, 200, 200,
255),\
fcolor = (0, 0, 0, 255), text = 'HLabel', multiline =
False,\
halign = 'center'):
HPanel.__init__(self, batch, x, y, w, h, bcolor)
self._text = text
self._label = pyglet.text.Label(text, x = x, y = y,\
color = fcolor, batch = batch,
\
multiline = multiline, width =
w,\
height = h, halign = halign)
c_w = self._label.content_width
font = self._label.document.get_font()
c_h = font.ascent + font.descent
self._label.x += (w - c_w) / 2
self._label.y = y + (h - c_h) / 2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---