Turtle Graphics

This commit is contained in:
Srishti 2022-10-15 11:07:41 +05:30
parent 421bf9468e
commit 51549f6a8b
3 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# Turtle Graphics
The turtle module provides an environment in which turtles move around on a 2-dimensional grid. Turtles have a position, heading (the direction the turtle is facing) and a variety of possible states (turtles can draw lines of a particular colour when they move or leave no trace) and actions (turn left or right; move forward or backward.
We can create amazing graphics using turtle and colorsys module.

View File

@ -0,0 +1,2 @@
turtle
colorsys

View File

@ -0,0 +1,21 @@
import turtle as tur
import colorsys as cs
tur.setup(800,800)
tur.speed(0)
tur.tracer(10)
tur.width(2)
tur.bgcolor("black")
for j in range(25):
for i in range(15):
tur.color(cs.hsv_to_rgb(i/15,j/25,1))
tur.right(90)
tur.circle(200-j*4,90)
tur.left(90)
tur.circle(200-j*4,90)
tur.right(180)
tur.circle(50,24)
tur.hideturtle()
tur.done()