tspart.studio

Module Contents

Classes

ColorMode

Create a collection of name/value pairs.

TspStudio

Functions

load(→ TspStudio)

save(filename, studio[, round_places])

class tspart.studio.ColorMode(*args, **kwds)

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

CMYK = 'CMYK'
RGB = 'RGB'
GRAYSCALE = 'L'
exception tspart.studio.InadequateResultsWarning

Bases: RuntimeWarning

Base class for warnings about dubious runtime behavior.

exception tspart.studio.InadequateResultsError

Bases: RuntimeError

Unspecified run-time error.

class tspart.studio.TspStudio(mode: ColorMode, image: PIL.Image.Image | str, num_points: int = 5000, line_width: float = 2, white_threshold: int = 254, invert: bool = False, background: Tuple[int, int, int] | str = (255, 255, 255), foreground: Tuple[int, int, int] | str = (0, 0, 0), points: Sequence[Sequence[float | Sequence[float]] | None] | None = None, is_routed: bool = False, jobs: Sequence[Sequence[int | str] | None | bool] | None = None)
property mode: ColorMode
property image: PIL.Image
property num_points: int
property line_width: float
property white_threshold: int
property invert
property background
property foreground
property points: Sequence[Sequence[float | Sequence[float]]]
property is_routed: bool
property jobs: Sequence[Sequence[int | str]]
property data
save(filename)
stipple(iterations=50, logging=True)
submit_online_solves(email, logging=True)
get_online_solves(logging=True)
cancel_online_solves()
online_solves(email, delay_minutes=0.25, requeue_minutes=10, logging=True, save_filename=None)
offline_solves(time_limit_minutes=60, symmetric=True, logging=True, verbose=False)
draw(scale=1, minimum_line_width_factor=1 / 255, closed=True, subpixels=8)
tspart.studio.load(filename) TspStudio
tspart.studio.save(filename, studio, round_places=2)