tessella package

Subpackages

Submodules

tessella.constraints module

class tessella.constraints.WidgetConstraints(position_x=0, position_y=0, min_width=0, min_height=0, max_width=0, max_height=0)[source]

Bases: object

Describes the layout constraints passed down from a parent widget to its child during the layout pass, bounding the position and the minimum/maximum size a widget is allowed to take.

Parameters:
  • position_x (int)

  • position_y (int)

  • min_width (int)

  • min_height (int)

  • max_width (int)

  • max_height (int)

position_x

The X coordinate available to the widget, in pixels.

Type:

int

position_y

The Y coordinate available to the widget, in pixels.

Type:

int

min_width

The minimum width the widget is allowed to take, in pixels.

Type:

int

min_height

The minimum height the widget is allowed to take, in pixels.

Type:

int

max_width

The maximum width the widget is allowed to take, in pixels.

Type:

int

max_height

The maximum height the widget is allowed to take, in pixels.

Type:

int

rect

The rect described by position_x, position_y, max_width and max_height.

Type:

pygame.Rect

classmethod from_rect(rect)[source]

A constructor for this class which derives the constraints from a pygame.Rect, using its position as the origin and its size as the maximum bounds, with no minimum size.

Parameters:

rect (pygame.Rect) – The rect to derive the constraints from.

Returns:

A new WidgetConstraints instance.

Return type:

WidgetConstraints

copy()[source]

Creates a copy of this instance.

Returns:

A new WidgetConstraints instance with the same attribute values as this one.

Return type:

WidgetConstraints

tessella.offset_surface module

class tessella.offset_surface.OffsetSurface(offset, size, flags=0)[source]

Bases: Surface

A pygame.Surface that translates every blit destination by a fixed offset, allowing content to be drawn using coordinates relative to a point other than the surface’s own origin.

Parameters:
  • offset (Vector2)

  • size (tuple[int, int])

  • flags (int)

offset

The offset subtracted from every blit destination.

Type:

pygame.Vector2

blit(source, dest, area=None, special_flags=0)[source]

Draws source onto this surface at dest, after subtracting offset from it.

Parameters:
  • source (pygame.Surface) – The surface to draw.

  • dest (tuple[int, int]) – The destination coordinates, before the offset is applied.

  • area (pygame.Rect | None) – The portion of source to draw. Draws the whole surface if None. Defaults to None.

  • special_flags (int) – The pygame.Surface special flags to blit with. Defaults to 0.