PSVG.Text package

Submodules

PSVG.Text.Font module

class PSVG.Text.Font.Font(family: str, weight: str)

Bases: dict

getBase64()

PSVG.Text.Paragraph module

class PSVG.Text.Paragraph.Paragraph(text: Text, w: float, h: float, x: float = 0, y: float = 0)

Bases: Section

set()
sublines(text: str)

PSVG.Text.Table module

class PSVG.Text.Table.Table(text, data: list[list[str]], w=0, h=0)

Bases: Section

add_box(row, col, value)

Adds a text box to the table at the intersection of row and column. If something exists there already this will overwrite it.

Parameters:
  • row – Integer represent the row to put the box in

  • col – Integer representing the column to but the box in

  • value – The text value of the text box

property c_rng
even_col_width(total_w)

Given the desired width, computes the column width for each column assuming all columns will have the same column width.

Parameters:

total_w – number representing the desired width of the table

even_row_height(total_h)

Given the desired height, computes the row height for each row assuming all rows will have the same row height.

Parameters:

total_h – number representing the desired height of the table

property r_rng
set()
set_box_color(row: int, col: int, color: tuple[int, int, int], opacity: float)
set_box_text(row: int, col: int, to_copy: Text)
set_col_color(col: int, color: tuple[int, int, int], opacity: float)
set_col_text(to_copy: Text, col: int)
set_col_width(width)
set_rect_color(rect: Rect, color: tuple[int, int, int], opacity: float)
set_row_color(row: int, color: tuple[int, int, int], opacity: float)
set_row_height(height)
set_row_text(to_copy: Text, row: int)
set_sizes()
weighted_col_width(total_w: float, weights: list[float])

Given the desired width and weights, computes the column width for each column.

Parameters:
  • total_w – number representing the desired width of the table

  • weights – list of percentages that define column widths

weighted_row_width(total_h: float, weights: list[float])

Given the desired height and weights, computes the row height for each row.

Parameters:
  • total_h – number representing the desired height of the table

  • weights – list of percentages that define row heights

class PSVG.Text.Table.TextBox(text: Text)

Bases: Section

center()
left()
middle()
right()
set()

PSVG.Text.Text module

class PSVG.Text.Text.Text(font, text='', size=10, x=0, y=0, angle=0, baseline=None, anchor=None, **kwargs)

Bases: Base

construct(depth)

Constructs the svg definition :param depth: current depth of this node in the svg tree :return: String containing the svg definition for this object

copy(item: Text = None)

Creates a copy of this node either by creating a new object or by adjusting the values of the object referenced by item

Parameters:

item – reference to an existing node

Returns:

a node with the same attributes as this node

property width

PSVG.Text.TextBox module

class PSVG.Text.TextBox.TextBox(text: Text, alignment=(1, 1), dL=3, dB=3, dR=3, dT=3, **kwargs)

Bases: Section

property fill
property fill_opacity
set()
property size
property stroke
property stroke_opacity
property stroke_width
property text
property textColor
property textOpacity

Module contents