Skip to content

Commit b7d0c16

Browse files
authored
Create Squre illusion.py
1 parent 413ec95 commit b7d0c16

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Shapes/Squre illusion.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#square illusion in Python
2+
3+
from turtle import *
4+
import random
5+
speed(8)
6+
setup(700,700)
7+
def Square(x,y,size,tilt_angle,c):
8+
up()
9+
goto(x,y)
10+
down()
11+
seth(tilt_angle)
12+
fillcolor(c)
13+
begin_fill()
14+
for i in range(4):
15+
fd(size)
16+
rt(90)
17+
end_fill()
18+
angle = 0
19+
size = 300
20+
21+
while size>0:
22+
Square(0,0,size,angle,(random.uniform(0,1),random.uniform(0,1),random.uniform(0,1)))
23+
size-=0.1
24+
angle+=3
25+
26+
ht()
27+
done()

0 commit comments

Comments
 (0)