# p.g.TextBox(Label) : class documentation

Part of planes.gui View In Hierarchy

    A box where the user can type text.

    To actually receive key events, the TextBox must be registered with the
    Display using Display.key_sensitive(TextBox).

    Attributes:

    TextBox.text
        Standard Label attribute, holding the text typed so far.

    TextBox.active
        Boolean flag whether this TextBox is active, initally False.

Method | __init__ | `Initialise the TextBox. If return_callback is given, return_callback(TextBox.text) will be called when [RETURN] is pressed.`
Method | keydown | `If printable, add keydown_event.unicode to self.text.`
Method | activate | `Call to show the user that the TextBox is ready for input. Sets TextBox.active to True.`
Method | deactivate | `Call to show the user that the TextBox no longer accepts input. Sets TextBox.active to False.`
Method | redraw | `Redraw the TextBox if necessary. If the TextBox is active, display a cursor behind the text.`

Inherited from Label:

Method | update | `Renew the text on the label, then call the base class method.`

Inherited from Plane (via Label):

Method | sub | `Remove the Plane given from its current parent and add it as a subplane of this Plane.`
Method | remove | `Remove subplane by name or Plane instance.`
Method | remove_all | `Convenience method to call Plane.remove() for all subplanes.`
Method | __getattr__ | `Access subplanes as attributes.`
Method | render | `Draw a composite surface of this plane and all subplanes, in order of their addition.`
Method | get_plane_at | `Return the (sub)plane and the succeeding parent coordinates at the given coordinates. Subplanes are tested in reverse order of their addition (i.e. latest first).`
Method | clicked | `Called when there is a MOUSEDOWN event on this plane. If click callbacks are set, the appropriate one is called with this Plane as argument.`
Method | dropped_upon | `If a plane is dropped on top of this one, call dropped_upon_callback() and conditionally grab it.`
Method | destroy | `Remove this Plane from the parent plane, remove all subplanes and delete all pygame Surfaces.`
Method | sync | `Save the Plane given as master Plane and the position offset to that Plane for position synchronisation in Plane.update().`
Method | unsync | `Remove the position synchronisation to the sync master Plane.`
Method | mouseover_callback | `Callback function when the mouse cursor moves over this plane. The default implementation sets Plan.mouseover to True when Plane.highlight is set.`
Method | mouseout_callback | `Callback function when the mouse cursor has left this plane. The default implementation sets Plan.mouseover to False.`
Method | __repr__ | `Readable string representation.`

def __init__(self, name, rect, return_callback=None, background_color=(250, 250, 250)):
overrides planes.gui.Label.__init__

    Initialise the TextBox.
    If return_callback is given, return_callback(TextBox.text) will be
    called when [RETURN] is pressed.

def keydown(self, keydown_event):

    If printable, add keydown_event.unicode to self.text.

def activate(self):

    Call to show the user that the TextBox is ready for input.
    Sets TextBox.active to True.

def deactivate(self):

    Call to show the user that the TextBox no longer accepts input.
    Sets TextBox.active to False.

def redraw(self, force=False):
overrides planes.gui.Label.redraw

    Redraw the TextBox if necessary.
    If the TextBox is active, display a cursor behind the text.