20181101173,荀梓恒
20181101197,叶普旭

 

 

 

代码如下:

import turtle as t
t.setup(width=0.5, height=0.75, startx=None, starty=None)
t.hideturtle()
t.speed(10)
t.pensize(2)
t.penup()
t.goto(100,200)
t.pendown()
t.setheading(90)
t.begin_fill()
t.colormode(255)
t.fillcolor(255,69,0)
t.circle(100,180)
t.left(7)
t.forward(100)
a=1
for i in range(45):
    if 0<=i<30:
        a=a+0.2
        t.lt(3)
        t.fd(a) 
    else:
        a=a-0.2
        t.lt(3)
        t.fd(a)
t.left(30)
t.forward(110)
t.end_fill()
t.pensize(1)
t.penup()
t.goto(17,252.5)
t.pendown()
t.goto(-23,252.5)
t.penup()
t.goto(-48,265)
t.pendown()
t.goto(-53,285)
t.penup()
t.goto(42,265)
t.pendown()
t.goto(47,288)
t.penup()
t.goto(-73,155)
t.pendown()
t.goto(-93,145)
t.penup()
t.goto(68,155)
t.pendown()
t.goto(90,145)
t.penup()
t.goto(-42,73)
t.pendown()
t.goto(-45,59)
t.penup()
t.goto(44,73)
t.pendown()
t.goto(47,60)
#头部
t.pensize(2)
t.penup()
t.goto(-97,175)
t.setheading(180)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,0,0)
t.forward(5)
t.setheading(264)
t.circle(160,30)
t.setheading(20)
t.forward(1)
t.end_fill()
t.penup()
t.goto(97,177)
t.setheading(0)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,0,0)
t.forward(5)
t.setheading(95)
t.circle(160,-30)
t.setheading(160)
t.forward(2)
t.end_fill()
#耳朵
t.penup()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,255,0)
t.goto(-58,260)
t.pendown()
t.goto(-78,120)
t.goto(-38,70)
t.goto(-32,78)
t.setheading(190)
t.circle(180,-20)
t.goto(40,70)
t.goto(72,120)
t.goto(52,260)
t.goto(22,275)
t.goto(12,230)
t.goto(-18,230)
t.goto(-28,275)
t.goto(-58,260)
t.end_fill()
#脸型
t.penup()
t.goto(-58,150)
t.pendown()
t.setheading(-15)
t.circle(220,30)
t.penup()
t.goto(-58,150)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(244,255,255)
t.goto(-60,132)
t.goto(-18,132)
t.goto(-18,142)
t.end_fill()
t.penup()
t.goto(55,150)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(244,255,255)
t.goto(57,132)
t.goto(15,132)
t.goto(15,142)
t.end_fill()
#眼
t.penup()
t.goto(-33,55)
t.setheading(225)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,0,0)
t.circle(40,270)
t.end_fill()
t.penup()
t.goto(-5,30)
t.setheading(0)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(244,255,255)
t.circle(7,360)
t.end_fill()
t.penup()
t.goto(-37,6)
t.pendown()
t.goto(-28,20)
t.goto(18,20)
t.goto(28,3)
t.penup()
t.goto(-42,35)
t.setheading(150)
t.pendown()
t.pensize(1)
t.circle(40,-30)
t.penup()
t.goto(18,20)
t.setheading(245)
t.pendown()
t.circle(40,-37)
#身体
t.begin_fill()
t.colormode(255)
t.fillcolor(255,69,0)
t.penup()
t.goto(-40,8)
t.pendown()
t.pensize(2)
t.goto(-70,-80)
t.goto(-75,-85)
t.goto(-50,-85)
t.goto(-20,-50)
t.goto(10,-50)
t.goto(45,-85)
t.goto(70,-85)
t.goto(65,-80)
t.goto(30,8)
t.goto(15,-7)
t.goto(-25,-7)
t.goto(-40,8)
t.end_fill()
#腿
t.penup()
t.goto(-25,-7)
t.pendown()
t.goto(-15,-30)
t.goto(5,-30)
t.goto(15,-7)
t.penup()
t.goto(-45,-10)
t.pendown()
t.goto(-20,-20)
t.penup()
t.goto(10,-20)
t.pendown()
t.goto(35,-10)
t.penup()
t.goto(-50,-20)
t.begin_fill()
t.colormode(255)
t.fillcolor(255,255,0)
t.goto(-50,-85)
t.goto(-75,-85)
t.goto(-20,-50)
t.end_fill()
t.penup()
t.goto(40,-20)
t.begin_fill()
t.colormode(255)
t.fillcolor(255,255,0)
t.goto(45,-85)
t.goto(70,-85)
t.goto(10,-50)
t.end_fill()
#腰带
t.penup()
t.goto(-45,59)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,255,0)
t.circle(12,80)
t.goto(-42,40)
t.end_fill()
t.penup()
t.goto(-50,43)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,69,0)
t.goto(-100,-70)
t.goto(-42,40)
t.end_fill()
t.penup()
t.goto(38,60)
t.setheading(140)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,255,0)
t.circle(12,-80)
t.goto(30,42)
t.end_fill()
t.penup()
t.goto(40,46)
t.pendown()
t.begin_fill()
t.colormode(255)
t.fillcolor(255,69,0)
t.goto(100,-70)
t.goto(33,42)
t.end_fill()
#手部
import random
for i in range(20):
    m=random.randint(10,30)
    x=random.randint(-600,500)
    y=random.randint(-600,500)
    r=random.randint(1,255)
    g=random.randint(1,255)
    b=random.randint(1,255)
    t.pencolor((r,g,b))
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.write("I am Iron Man.", font=("Times", m, "bold"))
    for i in range(2):
        n=random.randint(10,30)
        x=random.randint(-600,500)
        y=random.randint(-600,500)
        r=random.randint(1,255)
        g=random.randint(1,255)
        b=random.randint(1,255)
        t.pencolor((r,g,b))
        t.penup()
        t.goto(x,y)
        t.pendown()
        t.write("I love you three thousand times.", font=("Times", n, "bold"))
#文字
t.mainloop()

  

视频链接:https://www.bilibili.com/video/av52594737

 

posted on 2019-05-16 03:52  Xenos  阅读(542)  评论(0编辑  收藏  举报