World > Konsole#
API Reference#
Console#
- class miniworlds.worlds.gui.console.Console(*args, **kwargs)[Quellcode]#
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__()[Quellcode]#
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)[Quellcode]#
Appends a new line of text to the console.
Each call adds one label row. Older lines scroll up when the console is full.
- Rückgabetyp:
- Parameter:
text – The text string to display on the new line.
- Rückgabe:
The Label actor that was created for this line.
Examples
console.newline("Player position: " + str(player.position))
PagerHorizontal#
- class miniworlds.worlds.gui.pager.PagerHorizontal(*args, **kwargs)[Quellcode]#
- act()[Quellcode]#
- dialog#
- on_setup()[Quellcode]#
Hook for initial world setup.
Override this in subclasses or register a function with @world.register.
Examples
@world.register def on_setup(self): self.background = (0, 0, 0) Actor((20, 20))