Commit a5210ee7 by BellCodeEditor

auto save

parent bac5d92a
Showing with 36 additions and 0 deletions
#1、画什么
import turtle
#2、画在哪里 准备纸(大小 材质)
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 300
SCREEN_BGCOLOR = "black"
PEN_COLOR = "white"
PEN_SIZE = 2
PEN_SPEED = 5 #[0,10]
STARTX = -100
STARTY = 100
ANGLE = 170
LENGTH = 100
FILLCOLOR = "yellow"
turtle.screensize(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BGCOLOR)
#3、用什么画 准备笔(颜色 粗细 笔速)
pen = turtle.Pen()
pen.pencolor(PEN_COLOR)
pen.pensize(PEN_SIZE)
pen.speed(PEN_SPEED) #[0,10] 0最快 1-10慢慢变快
pen.shape("turtle")
#4、从哪里开始作画 起始点
pen.penup()
pen.goto(STARTX,STARTY) #pen.setpos()
pen.pendown()
#5、作画
pen.fillcolor(FILLCOLOR)
pen.begin_fill()
for times in range(0,100,1):
pen.forward(LENGTH)
pen.right(ANGLE)
pen.end_fill()
#6、完成收尾
pen.hideturtle()
turtle.done() #turle.mainloop()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment