awsc.termui.block.Block

class awsc.termui.block.Block(parent, alignment, dimensions, *args, weight=0, tag='default', **kwargs)

A Block object represents a section of the screen. A Block may contain additional Blocks or act as a control.

Attributes:
blockslist

A set of child Block objects.

weightint

Sibling blocks are drawn in order from highest weight to lowest weight.

parentawsc.termui.block.Block

The parent Block object. None indicates that the parent is the entire screen.

alignmentawsc.termui.alignment.AbstractAnchor

The anchor specifier for this Block within the parent Block.

dimensionsawsc.termui.alignment.Dimension

The size specifier for this Block.

tagstr

Tags allow grouping sibling Blocks, and removing them together.

Methods

add_block(block)

Adds a new child block to this block.

before_paint()

Hook function for acting on the block before any blocks are painted for the current frame.

bottomright()

Returns the coordinates of the bottom right corner of the block.

clear_blocks([tag])

Removes all blocks with the matching tag from the child blocks of this block.

input(key)

Input handler hook function.

paint()

Hook function for painting the block.

remove_block(block)

Removes a specific block from this block.

reparent()

Shorthand function for removing a Block from its parent and re-adding it.

topleft()

Returns the coordinates of the top left corner of the block.

on_become_frame

__init__(parent, alignment, dimensions, *args, weight=0, tag='default', **kwargs)

Initializes a Block object.

Parameters:
parentawsc.termui.block.Block

The parent Block object. None indicates that the parent is the entire screen.

alignmentawsc.termui.alignment.AbstractAnchor

The anchor specifier for this Block within the parent Block.

dimensionsawsc.termui.alignment.Dimension

The size specifier for this Block.

weightint

Sibling blocks are drawn in order from highest weight to lowest weight.

tagstr

Tags allow grouping sibling Blocks, and removing them together.

Methods

__init__(parent, alignment, dimensions, *args)

Initializes a Block object.

add_block(block)

Adds a new child block to this block.

before_paint()

Hook function for acting on the block before any blocks are painted for the current frame.

bottomright()

Returns the coordinates of the bottom right corner of the block.

clear_blocks([tag])

Removes all blocks with the matching tag from the child blocks of this block.

input(key)

Input handler hook function.

on_become_frame()

paint()

Hook function for painting the block.

remove_block(block)

Removes a specific block from this block.

reparent()

Shorthand function for removing a Block from its parent and re-adding it.

topleft()

Returns the coordinates of the top left corner of the block.

Attributes

corners

Read-only property for calculating the four corners of the block.

height

Read-only property for the height of the block.

inner

Read-only property for calculating the four inner corners of the block.

w_in

Read-only property for the inner width of the block.

width

Read-only property for the width of the block.