World > Console#
API Reference#
Console#
- class miniworlds.worlds.gui.console.Console(*args, **kwargs)[source]#
A scrolling text console that can be docked to a world.
Use console.newline(text) to append lines of text. The console is a special Toolbar that is typically docked below or beside the main world using world.camera.add_bottom(console) or world.camera.add_right(console).
Examples
console = Console() world.camera.add_bottom(console) @world.register def act(self): console.newline("Frame: " + str(world.frame))
- __init__()[source]#
Creates a console toolbar with compact text rows.
The console starts with a small default height and is intended for short log messages such as score changes, instructions, or debug output.
- dialog#
- newline(text)[source]#
Appends a new line of text to the console.
Each call adds one label row. Older lines scroll up when the console is full.
- Return type:
- Parameters:
text – The text string to display on the new line.
- Returns:
The Label actor that was created for this line.
Examples
console.newline("Player position: " + str(player.position))