首页 编程教程正文

初学Python,使用turtle库写了一个滑稽

piaodoo 编程教程 2020-02-22 22:09:04 968 0 python教程

本文来源吾爱破解论坛

初学Python,使用turtle库写了一个滑稽君。但......成果真有点滑稽,代码在编写时可能有点不足
[Python] 纯文本查看 复制代码

# -*- coding:utf-8 -*-
#滑稽君
import turtle
import time
start = time.perf_counter()
turtle.speed(0)
turtle.hideturtle()

#画整体部分
turtle.pensize(5)
turtle.penup()
turtle.goto(-10,-200)
turtle.pendown()
turtle.color("yellow")
turtle.begin_fill()
turtle.fillcolor("yellow")
turtle.circle(200)
turtle.end_fill()


#画左眼
turtle.penup()
turtle.color("orange")
turtle.pensize(1)
turtle.goto(-110,80)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("white")
turtle.seth(150)
turtle.pendown()
turtle.circle(145,64)
turtle.penup()
turtle.goto(-110,80)
turtle.pendown()
turtle.seth(-30)
turtle.circle(-25,150)
turtle.seth(155)
turtle.circle(140,55)
turtle.seth(150)
turtle.seth(180)
turtle.circle(-26,172)
turtle.end_fill()
turtle.color("black")
turtle.begin_fill()
turtle.fillcolor("black")
turtle.circle(-25)
turtle.end_fill()
turtle.penup()

#画右眼
turtle.color("orange")
turtle.goto(190,80)
turtle.pensize(1)
turtle.goto(190,80)
turtle.pendown()
turtle.begin_fill()
turtle.fillcolor("white")
turtle.seth(150)
turtle.pendown()
turtle.circle(145,64)
turtle.penup()
turtle.goto(190,80)
turtle.pendown()
turtle.seth(-30)
turtle.circle(-25,150)
turtle.seth(155)
turtle.circle(140,55)
turtle.seth(150)
turtle.seth(180)
turtle.circle(-26,172)
turtle.end_fill()
turtle.color("black")
turtle.begin_fill()
turtle.fillcolor("black")
turtle.circle(-25)
turtle.end_fill()
turtle.penup()


#画左眉
turtle.color("black")
turtle.seth(0)
turtle.goto(-180,150)
turtle.pendown()
turtle.pensize("25")
turtle.circle(-100,60)
turtle.penup()

#画右眉
turtle.seth(180)
turtle.goto(120,150)
turtle.pendown()
turtle.pensize("25")
turtle.circle(100,60)
turtle.penup()


#画嘴
turtle.goto(-130,-50)
turtle.seth(262)
for i in range(90):
    turtle.pensize(i*0.25)
    turtle.pendown()
    turtle.color("brown")
    turtle.circle(120,1.1)
for i in range(85):
    turtle.pensize(22.5 - 0.25*i)
    turtle.pendown()
    turtle.circle(120, 1.1)
turtle.penup()



#左腮红
turtle.goto(-100,-5)
turtle.pensize(1)
turtle.seth(0)
turtle.pendown()
turtle.seth(90)
turtle.begin_fill()
turtle.fillcolor("red")
for i in range(2):
    for j in range(10):
        turtle.fd(j)
        turtle.left(9)
    for j in range(10,0,-1):
        turtle.fd(j)
        turtle.left(9)
turtle.end_fill()
turtle.penup()


#右腮红
turtle.goto(160,-5)
turtle.pensize(1)
turtle.seth(0)
turtle.pendown()
turtle.seth(90)
turtle.begin_fill()
turtle.fillcolor("red")
for i in range(2):
    for j in range(10):
        turtle.fd(j)
        turtle.left(9)
    for j in range(10,0,-1):
        turtle.fd(j)
        turtle.left(9)
turtle.end_fill()
turtle.done()

版权声明:

本站所有资源均为站长或网友整理自互联网或站长购买自互联网,站长无法分辨资源版权出自何处,所以不承担任何版权以及其他问题带来的法律责任,如有侵权或者其他问题请联系站长删除!站长QQ754403226 谢谢。

有关影视版权:本站只供百度云网盘资源,版权均属于影片公司所有,请在下载后24小时删除,切勿用于商业用途。本站所有资源信息均从互联网搜索而来,本站不对显示的内容承担责任,如您认为本站页面信息侵犯了您的权益,请附上版权证明邮件告知【754403226@qq.com】,在收到邮件后72小时内删除。本文链接:https://www.piaodoo.com/7699.html

搜索