println()

println()#

Print text or other values to the screen.

Examples#

def draw():
    py5.square(py5.random_int(py5.width), py5.random_int(py5.height), 10)
    py5.println(f"frame count = {py5.frame_count}")

Description#

Print text or other values to the screen. For a Sketch running outside of a Jupyter Notebook, this method will behave the same as the Python’s builtin print method. For Sketches running in a Jupyter Notebook, this will place text in the output of the cell that made the run_sketch() call.

When running a Sketch asynchronously through Jupyter Notebook, any print statements using Python’s builtin function will always appear in the output of the currently active cell. This will rarely be desirable, as the active cell will keep changing as the user executes code elsewhere in the notebook. This method was created to provide users with print functionality in a Sketch without having to cope with output moving from one cell to the next.

Use set_println_stream() to customize the behavior of println().

Signatures#

println(
    *args,
    sep: str = " ",  # string inserted between values, defaults to a space
    end: str = "\n",  # string appended after the last value, defaults to newline character
    stderr: bool = False  # use stderr instead of stdout
) -> None

Updated on March 06, 2023 02:49:26am UTC