Screen#
Screen (also TurtleScreen) manages the window and canvas for turtle graphics.
Access the global screen via getscreen() or use module-level screen functions.
Setup#
Method / Alias |
Description |
|---|---|
|
Configure the window size and position. |
|
Set the scroll canvas size. |
|
Set user-defined coordinate system. |
|
Set the window title. |
|
Set turtle mode: |
Background#
Method |
Description |
|---|---|
|
Get or set the background color. |
|
Set a background image. |
|
Reset the screen to its initial state. |
|
Alias for |
Color and drawing#
Method |
Description |
|---|---|
|
Set color mode to |
|
Control animation updates. |
|
Perform a pending screen update (use after |
|
Set drawing delay in milliseconds. |
Event loop#
Method |
Description |
|---|---|
|
Start the event loop. |
|
Exit when the user clicks. |
|
Close the window. |
Input dialogs#
Method |
Description |
|---|---|
|
Show a numeric input dialog. |
|
Show a text input dialog. |
Events#
Method |
Description |
|---|---|
|
Bind a function to clicking on the canvas. |
|
Bind a function to a key press (key-release event). |
|
Bind a function to a key-down event. |
|
Bind a function to a key-up event. |
|
Set focus to the canvas for key event reception. |
|
Call |
Shapes and turtles#
Method |
Description |
|---|---|
|
Add a custom shape to the shape registry. |
|
Return a list of all registered shape names. |
|
Return a list of all turtles on the screen. |
|
Return the underlying canvas object. |
Context manager: no_animation#
from miniworlds_turtle import no_animation
with no_animation():
turtle.forward(100)
turtle.circle(50)
# screen updates here