Home > Blockchain >  Turtle Elements Won't Show Up In Developed Window
Turtle Elements Won't Show Up In Developed Window

Time:11-24

So I'm trying to piggyback off of a pong program, to make a maze program. All was good, until turtle litterely broke. The python version is 3.9.7, and here's the code, along with a screenshot of the window which results from the code running.

import turtle


#Screen: Should be 800 X 600 box, with blue background, and a title of "Test"
wn = turtle.Screen()
wn.title("Test")
wn.bgcolor("blue")
wn.setup(width=800, height=600)
wn.tracer(0)

#Simple character/shape, square, red.
character = turtle.Turtle()
character.speed(0)
character.shape("square")
character.color("red")
character.penup()
character.goto(0, 0)

#main loop
turtle.mainloop()

Below is where you will find a picture of the window. As you can see, the character is missing from 0, 0. How do I fix this? Is it something wrong in the code? Do I have to reinstall something? [1]: https://i.stack.imgur.com/LMclH.png

CodePudding user response:

you have to say:

while True:
     wn.update()

not:

turtle.mainloop()
  • Related