How to make turtle draw quicker?

Viewed 1122

My code:

import turtle

screen = turtle.Screen()
bob = turtle.Turtle()
screen.bgcolor("black")
bob.speed(0)


def crazy():
    for i in range(360):
        for colors in ['red', 'yellow', 'green', 'purple', 'orange', 'blue']:
            bob.pencolor(colors)
            bob.forward(i)
            bob.left(124)


crazy()

I want to speed this process of drawing up by a lot so it draws the final image quicker. Any ideas on how to do it?

Btw I'm working on an art montage python project and you can probably guess this one is going to be in it. All help is appreciated, Thank You.

1 Answers

Consider using turtle.tracer(0, 0) which will stop refreshing every time and at the end do turtle.update()

import turtle

screen = turtle.Screen()
bob = turtle.Turtle()
screen.bgcolor("black")

bob.speed(0)

turtle.tracer(0, 0)


def crazy():
    for i in range(360):
        for colors in ['red', 'yellow', 'green', 'purple', 'orange', 'blue']:
            bob.pencolor(colors)
            bob.forward(i)
            bob.left(124)


crazy()
turtle.update()

enter image description here

Related