World > Console

World > Console#

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

A console.

You can write text into the console

Public Data Attributes:

Inherited from Toolbar

background_color

Background color as Tuple, e.g. (255,255,255) for white.

padding_left

Defines left margin

padding_right

Defines right margin

padding_top

Defines top margin

padding_bottom

Defines bottom margin

Inherited from World

subclasses

surface

class_name

step

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

fps

Frames per second shown on the screen.

world_size_x

The x-world_size (defaults to view_size)

world_size_y

The y-world_size (defaults to view_size)

columns

rows

size

Set the size of world

default_fill_color

Set default fill color for borders and lines

default_is_filled

default_stroke_color

Set default stroke color for borders and lines.

default_border_color

Set default border color for borders and lines.

default_border

Sets default border color for actors

backgrounds

Returns all backgrounds of the world as list.

background

Returns the current background

has_background

registered_events

image

The current displayed image

fill_color

color

window

Gets the parent window

Inherited from WorldBase

surface

window

size

rect

topleft

window_docking_position

width

height

Public Methods:

__init__()

Base class for toolbars.

newline(text)

Inherited from Toolbar

__init__()

Base class for toolbars.

on_change()

implemented in subclasses

remove(item)

Removes a widget from the toolbar.

has_widget(key)

Checks if self.widgets has key

get_widget(key)

Gets widget by key

remove_all_widgets()

reorder()

update_width_and_height()

update()

The mainloop, called once per frame.

send_message(text)

Sends broadcast message

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

validate_parameters(x, y)

__init__([x, y])

add_right(world[, size])

add_bottom(world[, size])

remove_world(container)

get_world_connector(actor)

detect_position(pos)

Checks if position is in the world.

contains_rect(rect)

Detects if rect is completely on the world.

set_columns(value)

set_rows(value)

borders(value)

Gets all borders from a source (Position or Rect).

default_fill(value)

Set default fill color for borders and lines

get_background()

Returns the current background

switch_background(background)

Switches the background

remove_background([background])

Removes a background from world

set_background(source)

Adds a new background to the world

add_background(source)

Adds a new background to the world

start()

Starts the world, if world is not running.

stop([frames])

Stops the world.

start_listening()

stop_listening()

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

The method show() should always be called at the end of your program.

init_display()

play_sound(path)

plays sound from path

stop_sounds()

play_music(path)

plays a music from path

stop_music()

stops a music

get_mouse_position()

Gets the current mouse_position

get_mouse_x()

Gets x-coordinate of mouse-position

get_mouse_y()

Gets y-coordinate of mouse-position

get_prev_mouse_position()

gets mouse-position of last frame

is_mouse_pressed()

Returns True, if mouse is pressed

is_mouse_left_pressed()

Returns True, if mouse left button is pressed

is_mouse_right_pressed()

Returns True, if mouse right button is pressed

is_in_world(position)

send_message(message[, data])

Sends broadcast message

quit([exit_code])

quits app and closes the window

reset()

Resets the world Creates a new world with init-function - recreates all actors and actors on the world.

clear()

switch_world(new_world[, reset])

Switches to another world

get_color_from_pixel(position)

Returns the color at a specific position

get_from_pixel(position)

Gets Position from pixel

to_pixel(position)

on_setup()

Overwrite or register this method to call on_setup-Actions

add_to_world(actor, position)

Adds a Actor to the world.

detect_actors(position)

Gets all actors which are found at a specific position.

get_actors_from_pixel(pixel)

repaint()

Implemented in subclasses

update()

The mainloop, called once per frame.

handle_event(event[, data])

Event handling

register(method)

Used as decorator e.g. @register def method.

unregister(method)

direction(point1, point2)

distance_to(pos1, pos2)

direction_to(pos1, pos2)

load_world_from_db(file)

Loads a sqlite db file.

load_actors_from_db(file, actor_classes)

Loads all actors from db.

save_to_db(file)

Saves the current world an all actors to database.

screenshot([filename])

Creates a screenshot in given file.

get_columns_by_width(width)

get_rows_by_height(height)

get_events()

Gets a set of all events you can register

Inherited from WorldBase

__init__()

on_change()

implemented in subclasses

add_to_window(app, dock[, size])

update_width_and_height()

repaint()

Implemented in subclasses

blit_surface_to_window_surface()

remove(actor)

Implemented in subclasses

handle_event(event, data)

get_event(event, data)

Implemented in subclasses

update()

Implemented in subclasses

get_local_position(position)

on_new_actor(actor)

on_remove_actor(actor)

Private Data Attributes:

_abc_impl

Inherited from Toolbar

_abc_impl

Inherited from GUI

_abc_impl

Inherited from World

_abc_impl

_fps

_key_pressed

_animated

_is_filled

_orientation

_static

_step

_registered_methods

Inherited from WorldBase

_abc_impl

Inherited from ABC

_abc_impl

Private Methods:

_add_widget(widget[, key])

Inherited from Toolbar

_add_widget(widget[, key])

_widgets_total_height()

_set_widget_width(widget)

Inherited from GUI

_get_world_connector_class()

needed by get_world_connector in parent class

Inherited from World

_get_camera_manager_class()

_get_world_connector_class()

needed by get_world_connector in parent class

_create_event_manager()

_update_all_costumes()

updates costumes for all actors on the world

_act_all()

Overwritten in subclasses, e.g. physics_world.

_tick_timed_objects()


newline(text)[source]#
Return type:

Label