Package Things :: Module BoxOfTricks :: Class TextBlock
[frames] | no frames]

Class TextBlock

object --+
         |
        TextBlock

This will get you a quick block of text. Use setup() to get it going and draw() to display it.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
setup(self, richtext='<span>Say what?</span>', x=0, y=0, align=<enum PANGO_ALIGN_LEFT of type PangoAlignment>, width=-1)
 
draw(self, ctx)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

setup(self, richtext='<span>Say what?</span>', x=0, y=0, align=<enum PANGO_ALIGN_LEFT of type PangoAlignment>, width=-1)

 
Parameters:
  • richtext - The text you want to show, marked-up with pango's span tag and params. Some examples:
    1. font_desc="Sans 12" -- Choose generic sans-serif at 12 point size.
    2. foreground="#RRGGBB" -- Colour of span element. RRGGBB are hex couplets. #FF000 would be red.
  • x - The x coord.
  • y - The y coord.
  • align - Pass pango.ALIGN_LEFT, pango.ALIGN_CENTER or pango.ALIGN_RIGHT
  • width - A width in pixels that the text-block should wrap into.