Skip to content

Console Mirroring

Viewer Console Panopti has a built-in floating console that relays your script's prints/errors directly to the viewer, making it easy to debug without switching between windows. The console also supports colored text. To propagate your script's print stream to the viewer, simply call capture_prints() like so:

import panopti
viewer = panopti.connect(server_url="http://localhost:8080", viewer_id='client')
viewer.capture_prints(capture_stderr=True)

print("This message will appear in the viewer!")

# Print with custom color tags:
print("[COLOR:red]This is red text[/COLOR]")
print("[COLOR:magenta]This is magenta text[/COLOR]")
print("Here is [COLOR:green]mixed[/COLOR] text [COLOR:blue]coloring[/COLOR]!")

# Print directly to the viewer console (without printing locally):
viewer.print_colored("This is a yellow message", "yellow")

# Or with ANSI color tags:
print("\033[32mThis is a green message using ANSI codes\033[0m")
print("\033[31mThis is a red message using ANSI codes\033[0m")
print("\033[33mThis is a yellow message using ANSI codes\033[0m")
print("\033[34mThis is a blue message using ANSI codes\033[0m")
print("\033[35mThis is a magenta message using ANSI codes\033[0m")

viewer.hold()

The propagated print statements are accessible in the viewer's Console, which can be opened by clicking the following button:

ConsoleButton





Available Colors

The custom [COLOR:<color>] ... [/COLOR] tags support the following colors:

white
red
green
yellow
blue
magenta
cyan
black
bright-white
bright-red
bright-green
bright-yellow
bright-blue
bright-magenta
bright-cyan
bright-black

Or the corresponding ANSI tags:

ANSI color tags
ANSI color tags

Example: print("\033[32mThis is a green message\033[0m")

ANSI Code Color
\033[37m white
\033[31m red
\033[32m green
\033[33m yellow
\033[34m blue
\033[35m magenta
\033[36m cyan
\033[30m black
\033[97m bright-white
\033[91m bright-red
\033[92m bright-green
\033[93m bright-yellow
\033[94m bright-blue
\033[95m bright-magenta
\033[96m bright-cyan
\033[90m bright-black
Printing to Panopti console only - viewer.print_colored(...)

Print colored text directly to the viewer console.

Parameters:

Name Type Description Default
text str

The text to print

required
color str

Optional color name: white, red, green, yellow, blue, magenta, bright-red, bright-green, bright-yellow, bright-blue, bright-magenta

None
end str

The end character to print (default is \n)

'\n'