1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Turtle not working on Python in PyCharm for Mac - screen just flickers before error...

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to use Turtle using the code below but when the window pops up nothing happens and screen.exitonclick() also doesn't work. The screen just flickers for a few seconds and stops. Any ideas?

    from turtle import Turtle, Screen

    timmy_the_turtle = Turtle()
    timmy_the_turtle.shape("turtle")
    timmy_the_turtle.color("red")
    timmy_the_turtle.forward(100)
    timmy_the_turtle.right(90)

    screen = Screen()
    screen.exitonclick()


    I am then getting the following errors:

    Traceback (most recent call last):
    File "/Users/Work/PycharmProjects/Day18/main.py", line 5, in <module>
    timmy_the_turtle.color("red")
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/turtle.py", line 2217, in color
    pcolor = self._colorstr(pcolor)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/turtle.py", line 2697, in _colorstr
    return self.screen._colorstr(args)
    File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/turtle.py", line 1159, in _colorstr
    raise TurtleGraphicsError("bad color string: %s" % str(color))
    turtle.TurtleGraphicsError: bad color string: red

    Continue reading...

Compartilhe esta Página