chaco.overlays.text_box_overlay module

Defines the TextBoxOverlay class.

class chaco.overlays.text_box_overlay.TextBoxOverlay(component=None, *args, **kw)

Bases: chaco.abstract_overlay.AbstractOverlay

Draws a box with text in it.

align = Enum("ur", "ul", "ll", "lr")

Alignment of the text in the box:

  • “ur”: upper right

  • “ul”: upper left

  • “ll”: lower left

  • “lr”: lower right

alpha = Union(Float(1.0), None)

The alpha value to apply to bgcolor

alternate_position = Any

This allows subclasses to specify an alternate position for the root of the text box. Must be a sequence of length 2.

bgcolor = ColorTrait("transparent")

The background color for the box (overrides AbstractOverlay).

border_color = ColorTrait("dodgerblue")

The color of the outside box.

border_size = Int(1)

The thickness of box border.

border_visible = Bool(True)

The border visibility. Defaults to true to duplicate previous behavior.

font = KivaFont("modern 12")

The font to use for the text.

max_text_width = Float(0.0)

The maximum width of the displayed text. This affects the width of the text only, not the text box, which includes margins around the text and padding. A max_text_width of 0.0 means that the width will not be restricted.

overlay(component, gc, view_bounds=None, mode='normal')

Draws the box overlaid on another component.

Overrides AbstractOverlay.

padding = Int(5)

Number of pixels of padding around the text within the box.

text = Str

The text to display in the box.

text_color = ColorTrait("black")

The color of the text.