Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/turtle_graphics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 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.

![Screenshot (468)](https://user-images.githubusercontent.com/48403800/195971450-c57a6e04-f64e-413b-a29b-cdd59b5d8484.png)

We can create amazing graphics using _turtle_ and _colorsys_ module
2 changes: 2 additions & 0 deletions scripts/turtle_graphics/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
turtle
colorsys
21 changes: 21 additions & 0 deletions scripts/turtle_graphics/turtle_graphics.py
Original file line number Diff line number Diff line change
@@ -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()