Welt > Konsole

Welt > Konsole#

class miniworlds.worlds.gui.console.Console[Quellcode]#

Eine Konsole.

Sie können Text in die Konsole schreiben

Öffentliche Datenattribute:

Inherited from Toolbar

background_color

Hintergrundfarbe als Tupel, z.B. (255,255,255) für Weiß.

padding_left

Definiert den linken Rand

padding_right

Definiert den rechten Rand

padding_top

Definiert den oberen Rand

padding_bottom

Definiert den unteren Rand

Inherited from World

subclasses

tick_rate

Tick rate defines how often the method act() will be called.

fps

Bilder pro Sekunde auf dem Bildschirm angezeigt.

world_size_x

Gets the horizontal size of the world in pixels.

world_size_y

Gets the vertical size of the world in pixels.

columns

Gets the number of horizontal pixels (columns) visible in the world.

rows

Gets the number of vertical pixels (rows) visible in the world.

size

Gets the world size as a tuple (width, height), in pixels.

background

Returns the currently active background.

has_background

Returns True if the world has at least one background appearance.

actors

event_manager

clock

frame

is_running

actors_fixed_size

app

backgrounds

layout

data

mouse

draw

:py:obj:Musik <miniworlds.worlds.world.World.music>\

sound

Inherited from WorldBase

window

size

topleft

width

height

class_name

registered_events

Returns the set of all event names that are currently registered.

Öffentliche Methoden:

__init__()

Basisklasse für Symbolleisten.

newline(text)

Inherited from Toolbar

__init__()

Basisklasse für Symbolleisten.

on_change()

in Unterklassen implementiert

remove(item)

Entfernt ein Widget aus der Symbolleiste.

has_widget(key)

Prüft, ob self.widgets den Schlüssel hat

get_widget(key)

Widget nach Schlüssel abrufen

remove_all_widgets()

reorder()

update_width_and_height()

send_message(text)

Sends a broadcast message to the world and all actors.

scroll_up(value)

scroll_down(value)

can_scroll_down(value)

can_scroll_up(value)

on_new_actor(actor)

on_remove_actor(actor)

Inherited from GUI

add(actor)

Inherited from World

__init__([x, y])

contains_position(pos)

Prüft, ob die Position in der Welt ist.

contains_rect(rect)

Returns True if the entire rectangle is fully inside the world.

contains_rect_any(rect)

Returns True if any part of the rectangle is inside the world.

set_columns(value)

Internal method to set columns and sync world width.

set_rows(value)

Internal method to set rows and sync world height.

get_background()

Returns the current active background from the backgrounds manager.

switch_background(background)

Switches the current background to a specified one.

remove_background([background])

Removes a background from the world.

set_background(source)

Sets a new background and replaces the current active background.

add_background(source)

Adds a new background to the world and sets it as the active one.

start()

Starts or resumes the world.

stop([frames])

Stops the world immediately or after a delay in frames.

run([fullscreen, fit_desktop, replit, ...])

Starts the main application loop of the Miniworlds engine.

is_in_world(position)

Checks whether a given world position lies within the world's boundaries.

send_message(message[, data])

Sends a broadcast message to the world and all actors.

quit([exit_code])

Immediately quits the application and closes the game window.

reset()

Setzt die Welt zurück Erstellt eine neue Welt mit der Init-Funktion - erstellt alle Akteure und Akteure in der Welt neu.

get_from_pixel(position)

Converts a screen pixel position into a valid world position if inside bounds.

to_pixel(position)

Converts a world position to a screen pixel position.

on_setup()

Hook method to define initial setup logic when the world is created.

detect_actors(position)

Gets all actors which are found at a specific position (in global world coordinates)

get_actors_from_pixel(pixel)

Returns a list of all actors located at the given screen pixel position.

distance_to(pos1, pos2)

Calculates the Euclidean distance between two positions.

direction_to(pos1, pos2)

Calculates the angle from pos1 to pos2 in degrees.

Inherited from WorldBase

__init__()

remove(actor)

In Unterklassen implementiert

on_change()

in Unterklassen implementiert

on_new_actor(actor)

on_remove_actor(actor)

get_world_connector(actor)

screenshot([filename])

Saves a screenshot of the current window surface to a file.

get_events()

Prints a list of all events that can be registered in this world.

register(method)

Registers a method as a world event handler.

Private Datenattribute:

_abc_impl

Inherited from Toolbar

_abc_impl

Inherited from GUI

_abc_impl

Inherited from World

_abc_impl

_fps

_step

_key_pressed

_animated

_timed_objects

_dynamic_actors

_registered_methods

_mainloop

_collision_manager

Inherited from WorldBase

_abc_impl

Inherited from ABC

_abc_impl

Private Methoden:

_add_widget(widget[, key])

Inherited from Toolbar

_get_mainloopmanager_class()

_add_widget(widget[, key])

_widgets_total_height()

_set_widget_width(widget)

Inherited from GUI

_get_world_connector_class()

benötigt von get_world_connector in der übergeordneten Klasse

Inherited from World

_validate_parameters(x, y)

_clear()

Clears the world's state: event queue, all backgrounds, and all actors.

Inherited from WorldBase

_get_mainloopmanager_class()

_get_camera_manager_class()

_get_world_connector_class()

benötigt von get_world_connector in der übergeordneten Klasse

_create_event_manager()

_unregister(method)

Unregisters a previously registered world method.

_start_listening()

Enables input listening for the world.

_stop_listening()

Disables input listening for the world.


newline(text)[Quellcode]#
Rückgabetyp:

Label