turtle_notes
1
the Turtle module to draw a colorful spiral pattern on a black background.
You can use the Turtle module in Python to draw a colorful spiral pattern on a black background. Here's a simple example:
import turtle
# Set up the screen
screen = turtle.Screen()
screen.bgcolor("black")
# Create a turtle
t = turtle.Turtle()
t.speed(0) # Set the fastest drawing speed
# Define colors for the spiral
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
# Draw the spiral
for i in range(360):
t.pencolor(colors[i % len(colors)])
t.width(i/100 + 1)
t.forward(i)
t.left(59)
# Hide the turtle
t.hideturtle()
# Keep the window open
turtle.done()This code will draw a colorful spiral pattern on a black background using the Turtle module. Each loop iteration changes the pen color to one of the colors in the colors list, and the width of the pen increases as the loop progresses. The spiral is created by moving the turtle forward and turning it left at each step. Finally, we hide the turtle and keep the window open using turtle.done().
2
Drawing Shapes:
3
Drawing Patterns:
4
Spirograph Art:
5
Fractal Trees:
6
Draw a Square:
7
Last updated