Python Turtle 정리
<Activity>/21,22 컴퓨터 프로그래밍 강의조교2022. 4. 11. 13:16
반응형
# 시작할때 세팅
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)
반응형
'<Activity> > 21,22 컴퓨터 프로그래밍 강의조교' 카테고리의 다른 글
Teachable Machine 실행방법 A-Z (0) | 2021.12.12 |
---|---|
파이썬 변수 이해하기 (0) | 2021.03.19 |
댓글()