预科第二天

预科第二天

python蟒蛇

import turtle

t = turtle.Pen()
t.shape("turtle")
t.up()
t.fd(-250)
t.down()
t.seth(-40)
t.pensize(25)
t.color("red")
for i in range(4):
   t.circle(40,80)
   t.circle(-40,80)
t.left(40)
t.fd(20)
t.circle(25,180)
t.fd(20)
turtle.mainloop()

python五角星

import turtle
#导入海龟包
t = turtle.Pen()
t.fillcolor("red")
t.begin_fill()
time = 1
while time<=5:
   t.fd(150)
   t.right(144)
   time += 1
t.end_fill()

turtle.mainloop()

python正方形

import turtle
#导入海龟包
t = turtle.Pen()
t.shape("turtle")
t.fillcolor("red")
t.begin_fill()
for i in range(3):
   t.fd(100)
   t.left(120)
t.end_fill()

turtle.mainloop()

python 笑脸

import turtle
#导入海龟包
t = turtle.Pen()
t.shape("turtle")
turtle.setup(1000,700)
#窗口大小
t.speed(8)
#画的速度

#圆脸
t.pensize(3)
t.color('yellow')
t.goto(0,-300)
t.speed(16)
t.begin_fill()
t.circle(300,360)
t.end_fill()

# 左眼睛
t.speed(10)
t.up()
t.goto(-200, 50)
t.down()
t.color('black')
t.begin_fill()
t.fillcolor("white")
t.pensize(6)
t.seth(30)
t.circle(-240, 40)
t.seth(40)
t.circle(30, 90)
t.seth(158)
t.circle(180, 70)
t.seth(280)
t.circle(30, 86)
t.end_fill()
t.goto(-180, 63)
t.color("black")
t.pensize(1)
t.begin_fill()
t.fillcolor("black")
t.circle(22)
t.end_fill()

# 右眼睛
t.up()
t.goto(50, 80)
t.down()
t.color('black')
t.begin_fill()
t.fillcolor("white")
t.pensize(6)
t.seth(20)
t.circle(-240, 40)
t.seth(40)
t.circle(30, 90)
t.seth(150)
t.circle(180, 70)
t.seth(280)
t.circle(30, 86)
t.end_fill()
t.goto(70, 86)
t.color("black")
t.pensize(1)
t.begin_fill()
t.fillcolor("black")
t.circle(22)
t.end_fill()

# 嘴巴
t.up()
t.goto(-210, -50)
t.down()
t.pensize(5)
t.color("red")
t.seth(-70)
t.circle(215, 150)

# 眉毛
t.up()
t.goto(-210, 150)
t.down()
t.color("black")
t.seth(60)
t.circle(-120, 110)

t.up()
t.goto(40, 150)
t.down()
t.seth(60)
t.circle(-120, 110)
t.hideturtle()

turtle.mainloop()

 

 

 

你可能感兴趣的:(预科第二天)