#NEWLINE# def __init__( self , text = '' , font_name = None , font_size = None , bold = False , italic = False , color = None , x = 0 , y = 0 , width = None , height = None , anchor_x = 'left' , anchor_y = 'baseline' , align = 'left' , multiline = False , dpi = None , batch = None , group = None ) : #NEWLINE# #INDENT# 'Create a rich text label.\n\n        :Parameters:\n            `text` : str\n                Pyglet attributed (rich) text to display.\n            `font_name` : str or list\n                Font family name(s).  If more than one name is given, the\n                first matching name is used.\n            `font_size` : float\n                Font size, in points.\n            `bold` : bool\n                Bold font style.\n            `italic` : bool\n                Italic font style.\n            `color` : (int, int, int, int) or None\n                Font colour, as RGBA components in range [0, 255].\n                None to use font colors defined by text attributes.\n            `x` : int\n                X coordinate of the label.\n            `y` : int\n                Y coordinate of the label.\n            `width` : int\n                Width of the label in pixels, or None\n            `height` : int\n                Height of the label in pixels, or None\n            `anchor_x` : str\n                Anchor point of the X coordinate: one of ``"left"``,\n                ``"center"`` or ``"right"``.\n            `anchor_y` : str\n                Anchor point of the Y coordinate: one of ``"bottom"``,\n                ``"baseline"``, ``"center"`` or ``"top"``.\n            `align` : str\n                Horizontal alignment of text on a line, only applies if\n                a width is supplied. One of ``"left"``, ``"center"``\n                or ``"right"``.\n            `multiline` : bool\n                If True, the label will be word-wrapped and accept newline\n                characters.  You must also set the width of the label.\n            `dpi` : float\n                Resolution of the fonts in this layout.  Defaults to 96.\n            `batch` : `Batch`\n                Optional graphics batch to add the label to.\n            `group` : `Group`\n                Optional graphics group to use.\n\n        ' #NEWLINE# text = ( '{color (255, 255, 255, 255)}' + text ) #NEWLINE# document = pyglet . text . decode_attributed ( text ) #NEWLINE# super ( PygletRichLabel , self ) . __init__ ( document , x , y , width , height , anchor_x , anchor_y , multiline , dpi , batch , group ) #NEWLINE# style = dict ( align = align ) #NEWLINE# if font_name : #NEWLINE# #INDENT# style [ 'font_name' ] = font_name #NEWLINE# #UNINDENT# if font_size : #NEWLINE# #INDENT# style [ 'font_size' ] = font_size #NEWLINE# #UNINDENT# if bold : #NEWLINE# #INDENT# style [ 'bold' ] = bold #NEWLINE# #UNINDENT# if italic : #NEWLINE# #INDENT# style [ 'italic' ] = italic #NEWLINE# #UNINDENT# if color : #NEWLINE# #INDENT# style [ 'color' ] = color #NEWLINE# #UNINDENT# self . document . set_style ( 0 , len ( self . document . text ) , style )