Output turns black right after running the program in Python Turtle

Hi there, when I’m not using teams, and I just press Create (+), when we run our programs, we can see the output and then it just disappears and turns black again. We cannot find the output elsewhere. We are using Python Turtle with the given template

Repl link/Link to where the bug appears:

Screenshots, links, or other helpful context:
I can’t screenshot it fast enough to show the square with 4 colors, then a black screen

This is the Template Repl for Python with Turtle.

Python with Turtle lets you make graphics easily in Python.

Check out the official docs here: https://docs.python.org/3/library/turtle.html

import turtle

# Fullscreen the canvas
screen = turtle.Screen()
screen.setup(1.0, 1.0)

# Begin!
t = turtle.Turtle()

for c in ['red', 'green', 'blue', 'yellow']:

Try adding this code to the end of your program:


Hi @MsMurphyCS !
At the end of the program, add this line:

t.mainloop() # Prevents the drawing from disappearing

Hope this helps!

1 Like

I appreciate the help! But that doesn’t explain why it changed and why I have to use other statements to stop it.
When I open the assignments in Teams and run those, the black screen does not appear. WHen I’m trying to teach, using Create(+), then it disappears so we can’t see it

This code line did not work, but thank you

Error Cannot access member “mainloop” for type “Turtle”
Member “mainloop” is unknown

ah, I think it’s


to get back the previous behaviour, replace the modules line in the hidden .replit file with

modules = ["python-with-prybar-3.10:v2-20230925-77b13e4"]
1 Like

Is that going to fix it for all students and for all programs?

oh, it won’t. You’d have to change the .replit file in each Turtle repl.
you could have this be run in Shell if that makes the process faster.

sed -i '/^modules/s/python-3.\(.*\):.*"/python-with-prybar-3.\1:v2-20230925-77b13e4"/' .replit

Ok so now my question is still - why is it changed and only on the new ones and not the assignments they are doing in Teams? And why would replit change it so I cannot see my output? So frustrating sorry

since the interpreter has been removed, the python process now immediately exits after the program finishes

1 Like

Ok. So where can we find the output for our turtle drawings then?

if you use the solutions from my post or Alex’s post it should pop up in the Output tab as before.
Or you could use

I don’t know any easier way this can be solved