• Turtle笔记+一只发条人


          turtle.penup()别名turtle.pu():拾起画笔

          turtle.pendown()别名turtle.pd():放下画笔,

          turtle.color(color1, color2):同时设置pencolor=color1, fillcolor=color2。

          turtle.pencolor(color)  有三种方式:

                                              turtle.pencolor(‘purple’) 

                                               turtle.pencolor(255,255,255)

                                               turtle.pencolor(1,1,1) 

           turtle.fillcolor(colorstring):绘制图形的填充颜色

           turtle.home():设置当前画笔位置为原点,朝向东。

           turtle.dot(r):绘制一个指定直径和颜色的圆点。

           turtle.begin_fill():准备开始填充图形。

           turtle.end_fill():填充完成。

           turtle.hideturtle():隐藏画笔的turtle形状。

           turtle.showturtle():显示画笔的turtle形状

           turtle.forward(distance)(别名:turtle.fd):向当前画笔方向移动distance像素长度。

           turtle.backward(distance):向当前画笔相反方向移动distance像素长度。注意转向不变

           turtle.right(angle):顺时针移动angle

            turtle.left(angle):逆时针移动angle。

           turtle.circle(radius, extent=None, steps=None




    链接:https://www.jianshu.com/p/c59ee2ea6fd2

    import turtle
    
    turtle.pencolor("black")
    turtle.pensize(3)
    turtle.pendown()
    turtle.fd(120)
    turtle.seth(90)
    turtle.fd(80)
    turtle.seth(180)
    turtle.fd(120)
    turtle.seth(-90)
    turtle.fd(80)
    turtle.penup()
    turtle.goto(25,55)
    turtle.seth(0)
    turtle.pendown()
    turtle.fd(25)
    turtle.penup()
    turtle.fd(20)
    turtle.pendown()
    turtle.fd(25)
    turtle.penup()
    turtle.goto(45,20)
    turtle.pendown()
    turtle.fd(30)
    turtle.penup()
    turtle.goto(0,0)
    turtle.pendown()
    turtle.fd(135)
    turtle.goto(-15,0)
    turtle.seth(-90)
    turtle.fd(360)
    turtle.seth(0)
    turtle.fd(150)
    turtle.seth(90)
    turtle.fd(360)
    turtle.penup()
    turtle.goto(60,-360)
    turtle.seth(90)
    turtle.pendown()
    turtle.fd(200)
    turtle.seth(0)
    turtle.pensize(18)
    turtle.fd(75)
    turtle.seth(180)
    turtle.fd(150)
    turtle.penup()
    turtle.goto(135,-25)
    turtle.seth(0)
    turtle.pendown()
    turtle.fd(30)
    turtle.pensize(2)
    turtle.fd(20)
    turtle.seth(90)
    turtle.fd(20)
    turtle.seth(-90)
    turtle.fd(40)
    turtle.seth(90)
    turtle.fd(20)
    turtle.seth(0)
    turtle.fd(20)
    turtle.circle(20,360)
    turtle.circle(-20,360)
    turtle.penup()
    turtle.fd(-280)
    turtle.pendown()
    turtle.pensize(22)
    turtle.fd(60)
    turtle.done()

    一个很简单的人形图案,是这几天的学习的一点点结果

     仅仅用几种代码即可,大家可多多发挥自己想象力

  • 相关阅读:
    RabbitMQ安装(发生系统错误5。拒绝访问。发生系统错误1067。进程意外终止。)
    SQLServer执行脚本提示“系统找不到指定的文件”或“内存资源不足”
    TypeScript@HelloWorld!
    超详细Node安装教程
    进制转换
    菜鸟成长记
    ASP.NET Core中使用MialKit实现邮件发送
    VS未能正确加载 ”Microsoft.VisualStudio.Editor.Implementation.EditorPackate“包错误解决方法
    C#Winfrom Listview数据导入Excel
    安装研发服务器
  • 原文地址:https://www.cnblogs.com/Glzt/p/12489122.html
Copyright © 2020-2023  润新知