.. a7 Graphics Object class

.. _glabel-label:

Class GLabel
=============
This class is exactly like a :ref:`GRectangle <grectangle-label>`, except that it has the 
possibility of containing some text.
    
The attribute ``text`` defines the text content of this label.  Uses of the escape character 
'\n' will result in a label that spans multiple lines.  As with any `GRectangle`, the 
background color of this rectangle is ``fillcolor``, while ``linecolor`` is the color of 
the text.
    
The text itself is aligned within this rectangle according to the attributes ``halign``
and ``valign``.  See the documentation of these attributes for how alignment works.  
There are also attributes to change the point size, font style, and font name of the 
text. The ``width`` and ``height`` of this label will grow to ensure that the text will 
fit in the rectangle, no matter the font or point size.
    
To change the font, you need a .ttf (TrueType Font) file in the **Fonts** folder; refer 
to the font by filename, including the .ttf. If you give no name, it will use the 
default Kivy font.  The ``bold`` attribute only works for the default Kivy font; for 
other fonts you will need the .ttf file for the bold version of that font.  See the
provided **ComicSans.ttf** and **ComicSansBold.ttf** for an example.

Constructor
-----------
.. autoclass:: game2d.grectangle.GLabel

Attributes
----------
This class has all of the attributes of  :ref:`GRectangle <grectangle-label>`.  In addition,
it has the following new attributes.

.. currentmodule:: game2d.grectangle
.. autoattribute:: GLabel.text
.. autoattribute:: GLabel.font_size
.. autoattribute:: GLabel.font_name
.. autoattribute:: GLabel.bold
.. autoattribute:: GLabel.halign
.. autoattribute:: GLabel.valign

Methods
-------

This class does not have any methods beyond those defined in :ref:`GObject <gobject-label>`.

:ref:`Return to top level <top-label>`