TORX

Visualization

Render a circuit as text.

TextDrawingclass
TextDrawing(lines: list[str])

ASCII circuit drawing that can be printed.

draw_circuitfunction
draw_circuit(
    circuit: AbstractPCircuit,
    *,
    output: bool = True,
    unroll: bool = False,
) -> TextDrawing | None

Create ASCII representation of a circuit.

Arguments:

  • circuit: The circuit to draw.
  • output: If True (default), print the circuit and return None. If False, return a TextDrawing object.
  • unroll: If True, repeat the circuit content reps times instead of showing a box with "xN". Default is False.

Returns:

A TextDrawing object if output=False, otherwise None.