日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python画图比赛_Python选修课第二届Turtle绘图大赛

發布時間:2023/12/4 python 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python画图比赛_Python选修课第二届Turtle绘图大赛 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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()

總結

以上是生活随笔為你收集整理的python画图比赛_Python选修课第二届Turtle绘图大赛的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。