My Python with Turtle Output Shell appears, and then disappears quickly when the code is run

Bug description:
Python with Turtle output shell disappears

Expected vs Current Behavior:
Shell should remain open and visible, so you can see what you are drawing with the code.

Steps to reproduce:

Bug appears at this link: https://replit.com/account

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Google Chrome Version 120.0.6099.216 (Official Build) (x86_64) on MacBook Air Sonoma 14.2.1

Replit Profile: https://replit.com/@ErikAnderson2

This is not a bug. That is just the default behavior of turtle. You can add turtle.exitonclick() to the end and the drawing will remain until you click exit.

3 Likes

Thank you very much! This worked. Although, I have been using Python with Turtle for years and have never had this issue, nor needed to use this line of code. The shell would just pop open and stay open by itself.
But, again, thank you. :slight_smile:

1 Like

Yes, replit programs now immediately stop after running by default (the old behavior was that you could type in the console after the program ended).

Easy ways to fix this are putting any of these lines at the end of the program:

turtle.mainloop()
turtle.exitonclick()
input('...')

Please mark the post that helped you the most as solution so that others can easily find it.

4 Likes

A post was merged into an existing topic: Screen turn black after code done

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.