Python Turtle 정리

반응형
# 시작할때 세팅
import turtle as t
t.shape("turtle")

#거북이없이 그냥열기
s = t.Screen() #스크린객체 생성(스크린열기)
t.color("yellow","blue") # 선은 노랑, 거북이는 파랑
t.color("white") # 선색상이 하얀색
t.bgcolor("black") # 배경색 검정
t.pensize(5) # 펜두께
t.fd(100) # 100 만큼 앞으로이동
t.lt(120) # 120도 왼쪽으로 회전함
t.speed(0) # 1가장느림,10빠르게,0가장빠르게

home = t.textinput("집주소","집주소는?:")
t.write("안녕하세요?"+home+"에 사시는군요")
for i in range(5):  # 별그림
	t.left(144)
	t.fd(200)
    
t.fillcolor("white") #색상채우기
t.begin_fill() #색상채우기 시작
t.end_fill() #색상채우기 종료
t.ht() # 거북이 숨기기
image1 = "a.gif"
image2 = "b.gif"
s.addshape(image1) 
s.addshape(image2)
image_choice =  0
if vacation_spot == 0 :
	t.shape(image1)
else :
	t.shape(image2)
반응형

댓글()