Python/Python Training

[Python] 사각형 그리기 출력화면

군우 2018. 1. 9. 13:40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import turtle
 
colors = ["red", "purple", "blue", "green", "yellow", "orange" ]
 
t = turtle.Turtle()
 
 
turtle.bgcolor("black")
 
t.speed(0)
 
t.width(3)
 
length = 10    
 
 
 
while length < 500:    
 
    t.forward(length)            
 
    t.pencolor(colors[length%6])    
 
    t.right (89)            
 
    length += 5    
cs

출력화면