[Python] I want to see if my turtle position is in my dictionary [duplicate]

Discussão em 'Python' iniciado por Stack, Fevereiro 2, 2025.

  1. Stack

    Stack Membro Participativo

    A part of the code:

    import turtle

    #Set up window
    turtle.shape("classic")
    turtle.turtlesize(2,2,1)
    turtle.setup( 500 , 500 )
    turtle.Screen().bgcolor("black")
    turtle.color("red")
    turtle.pencolor("red")
    turtle.penup()
    window = turtle.Screen()

    i = 1
    points = {}

    points = turtle.pos()

    if turtle.pos() in points:
    insideDict = True
    i += 1
    points = turtle.pos
    else:
    insideDict = False


    Even though the turtle's postion has not change since the postion was put in the dictnary, the "insideDict" reads False. I tried using turtle.pos(), turtle.postion, turtle.postion() and a mix of each.

    Continue reading...

Compartilhe esta Página