Hello! I am creating a turtle code where I want to create multiple circles on a map. However, my turtle is currently coninuing to go around in a circle over and over again, and so the other circles cannot happen. Any help or advice will be greatly appreciated! Thanks!

This is my code:

def mapofbins():
    #sig: str -> turtle
    #campus map is the background
    #shows where on campus the compost bins on a campus map
    #setting the background image 
    screen = turtle.Screen()
    screen.setup(600,500)
    screen.bgpic("campusmap")
    #creates a circle around x
    circle = turtle.Turtle()
    circle.speed(0)
    circle.penup()
    circle.forward(50)
    circle.right(90)
    circle.forward(50)
    circle.pendown()
    while True:
        circle.forward(1)
        circle.left(1.15)
        if abs(circle.pos())<1:
            break
    #creates a circle around y
        circle2 = turtle.Turtle()
        circle2.speed(0)
    circle2.penup()
    circle2.forward(50)
    circle2.left(90)
    circle2.forward(50)
    circle2.pendown()
    while True:
        circle2.forward(1)
        circle2.left(1.15)
        if abs(circle2.pos())<1:
            break

mapofbins()

My turtle skills are rusty, but it must be in your condition to break the while loop. Try using something other than 1 for position, like a large number and see if that breaks the loop. At least you will know if that is the source of your problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.