快上网建站品牌

13518219792
  • 首页
  • 关于我们
    • 如何选择
    • 选择理由
  • 案例作品
    • 网站建设
    • 优化推广
    • 微信开发
    • 电商托管
  • 服务项目
    • 网站建设
    • 移动端/APP
    • 微信/小程序
    • 技术支持
    • 其它服务
  • 建站知识
    • 成都网站建设
    • 成都做网站
    • 成都网站设计
  • 网站售后
    • 成都网站运营
    • 成都网站维护
    • 成都网站推广
  • 客服中心
  • 全国分站

如何用python画猪头

用python画猪头的方法:首先设置画布和画笔,代码为【a.screensize(400,300)a.setup(width=400,height=300)】;然后画脸型,代码为【.goto(-100,100)】;最后留存图像在画布上即可。

成都创新互联专注为客户提供全方位的互联网综合服务,包含不限于网站设计、网站制作、临澧网络推广、微信小程序开发、临澧网络营销、临澧企业策划、临澧品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;成都创新互联为所有大学生创业者提供临澧建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com

【相关学习推荐:python视频】

用python画猪头的方法:

画布和画笔设置

import turtle as a
a.screensize(400,300)//设置屏幕大小
a.setup(width=400,height=300)//设置画布大小
a.pensize(15)//设置画笔宽度
a.speed(5)//设置画笔速度
a.hideturtle()//隐藏画笔

画脸盘子

a.penup()//提笔
a.goto(-100,100)//移动画笔位置
a.setheading(180)//设置朝向正西
a.pencolor("pink")
a.pendown()//放笔
a.circle(200)

取名字

a.penup()//取名
a.goto(-150,10)
yourname=a.textinput("请老实回答","你的名字是?")
name=yourname+"崽崽"
a.pendown()
a.write(name,font=("elephant",25,"bold"))//打印文本

画眼睛

a.penup()//画左眼
a.goto(-200,0)
a.pendown()
a.circle(25)
a.penup()
a.goto(-200,-14)
a.pendown()
a.circle(9)
a.penup()//光晕
a.goto(-190,-20)
a.pencolor("white")
a.pendown()
a.dot(10)
a.penup()//画右眼
a.pencolor("pink")
a.goto(0,0)
a.pendown()
a.circle(25)
a.penup()//光晕
a.goto(0,-14)
a.pendown()
a.circle(9)
a.penup()
a.goto(-10,-20)
a.pencolor("white")
a.pendown()
a.dot(10)

画鼻子

a.penup()//画鼻子
a.speed(10)//设置画笔速度
a.pencolor("pink")
a.goto(-150,-75)
a.setheading(45)
a.pendown()
for i in range(90):
    a.forward(1.5)
    a.right(1)
for i in range(3): //圆化棱角,每转16度向前走3个像素
    a.right(16)
    a.forward(3)
a.forward(15)
for i in range(3): //圆化棱角
    a.right(16)
    a.forward(3)
a.setheading(225)
for i in range(90):
    a.forward(1.5)
    a.right(1)
for i in range(3): //圆化棱角
    a.right(16)
    a.forward(3)
a.forward(15)
for i in range(3): //圆化棱角
    a.right(16)
    a.forward(3)
a.penup()
a.speed(5)//设置画笔速度
a.goto(-125,-70)//第一条杠
a.setheading(270)
a.pendown()
a.forward(50)
a.penup()
a.goto(-70,-65)//第二条杠
a.pendown()
a.forward(55)

画嘴巴

a.penup()//画嘴巴
a.speed(10)//设置画笔速度
a.goto(-135,-165)
a.setheading(305)
a.pendown()
for i in range(120):
    a.forward(1)
    a.left(1)

画耳朵

a.penup()//画右耳朵
a.speed(5)
a.setheading(0)
a.goto(-17,90)
a.pendown()
a.forward(60)
a.penup()
a.goto(28,75)//跳到下一笔起始位置
a.setheading(45)
a.pendown()
a.forward(110)
a.right(45)
a.forward(40)
a.setheading(225)
a.forward(40)
a.setheading(270)
for i in range(7): //圆化棱角
    a.right(2.5)
    a.forward(10)
a.forward(80)
a.penup()//画左耳朵
a.goto(-183,90)
a.setheading(180)
a.pendown()
a.forward(60)
a.penup()
a.goto(-230,75)//跳到下一笔起始位置
a.setheading(135)
a.pendown()
a.forward(110)
a.left(45)
a.forward(40)
a.setheading(-45)
a.forward(40)
a.setheading(270)
for i in range(10): //圆化棱角
    a.left(2.5)
    a.forward(15)

画腮红

a.penup()//画左腮红
a.pencolor("tomato")//设置成番茄色
a.goto(-250,-100)
a.setheading(270)
a.pendown()
a.forward(20)
a.penup()
a.goto(-210,-100)
a.pendown()
a.forward(20)
a.penup()//画右腮红
a.goto(10,-100)
a.pendown()
a.forward(20)
a.penup()
a.goto(50,-100)
a.pendown()
a.forward(20)
a.done() //留存图像在画布上

献上完整源代码

#!/usr/bin/env python3.7 #指明用什么可执行程序运行这个文件代码
#-*- coding:UTF-8 -*-   #保证能顺利解析中文
#author:Boosirit time:2020/4/5
import turtle as a
a.screensize(400,300)#设置屏幕大小
a.setup(width=400,height=300)#设置画布大小
a.pensize(15)#设置画笔宽度
a.speed(5)#设置画笔速度
a.hideturtle()#隐藏画笔
a.penup()#画脸
a.goto(-100,100)
a.setheading(180)#设置朝向正西
a.pencolor("pink")
a.pendown()
a.circle(200)
a.penup()#取名
a.goto(-150,10)
yourname=a.textinput("请老实回答","你的名字是?")
name=yourname+"崽崽"
a.pendown()
a.write(name,font=("elephant",25,"bold"))#打印文本
a.penup()#画左眼
a.goto(-200,0)
a.pendown()
a.circle(25)
a.penup()
a.goto(-200,-14)
a.pendown()
a.circle(9)
a.penup()#光晕
a.goto(-190,-20)
a.pencolor("white")
a.pendown()
a.dot(10)
a.penup()#画右眼
a.pencolor("pink")
a.goto(0,0)
a.pendown()
a.circle(25)
a.penup()#光晕
a.goto(0,-14)
a.pendown()
a.circle(9)
a.penup()
a.goto(-10,-20)
a.pencolor("white")
a.pendown()
a.dot(10)
a.penup()#画鼻子
a.speed(10)#设置画笔速度
a.pencolor("pink")
a.goto(-150,-75)
a.setheading(45)
a.pendown()
for i in range(90):
    a.forward(1.5)
    a.right(1)
for i in range(3):#圆化棱角,每转16度向前走3个像素
    a.right(16)
    a.forward(3)
a.forward(15)
for i in range(3):#圆化棱角
    a.right(16)
    a.forward(3)
a.setheading(225)
for i in range(90):
    a.forward(1.5)
    a.right(1)
for i in range(3):#圆化棱角
    a.right(16)
    a.forward(3)
a.forward(15)
for i in range(3):#圆化棱角
    a.right(16)
    a.forward(3)
a.penup()
a.speed(5)#设置画笔速度
a.goto(-125,-70)#第一条杠
a.setheading(270)
a.pendown()
a.forward(50)
a.penup()
a.goto(-70,-65)#第二条杠
a.pendown()
a.forward(55)
a.penup()#画嘴巴
a.speed(10)#设置画笔速度
a.goto(-135,-165)
a.setheading(305)
a.pendown()
for i in range(120):
    a.forward(1)
    a.left(1)
    
a.penup()#画右耳朵
a.speed(5)
a.setheading(0)
a.goto(-17,90)
a.pendown()
a.forward(60)
a.penup()
a.goto(28,75)#跳到下一笔起始位置
a.setheading(45)
a.pendown()
a.forward(110)
a.right(45)
a.forward(40)
a.setheading(225)
a.forward(40)
a.setheading(270)
for i in range(7):#圆化棱角
    a.right(2.5)
    a.forward(10)
a.forward(80)
a.penup()#画左耳朵
a.goto(-183,90)
a.setheading(180)
a.pendown()
a.forward(60)
a.penup()
a.goto(-230,75)#跳到下一笔起始位置
a.setheading(135)
a.pendown()
a.forward(110)
a.left(45)
a.forward(40)
a.setheading(-45)
a.forward(40)
a.setheading(270)
for i in range(10):#圆化棱角
    a.left(2.5)
    a.forward(15)
    
a.penup()#画左腮红
a.pencolor("tomato")#设置成番茄色
a.goto(-250,-100)
a.setheading(270)
a.pendown()
a.forward(20)
a.penup()
a.goto(-210,-100)
a.pendown()
a.forward(20)
a.penup()#画右腮红
a.goto(10,-100)
a.pendown()
a.forward(20)
a.penup()
a.goto(50,-100)
a.pendown()
a.forward(20)
a.done()#留存图像在画布上

想了解更多编程学习,敬请关注php培训栏目!


分享标题:如何用python画猪头
文章转载:http://gydahua.com/article/cheiid.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流

其他资讯

  • JavaScript调试的重要性是什么-创新互联
  • 建设一个网站的具体步骤,都需要注意哪些?
  • 如何使用HandlerThrea?
  • vb.net通讯录管理 vb通讯录管理系统课程设计
  • go语言虚拟机,go运行时和虚拟机的区别
  • dw表格css样式 dw设置css样式
  • jquery遮盖层图片 遮罩html
  • MySQL主键怎么修改 mysql修改主键名称
  • 苹果电脑macbook的快捷键 苹果电脑macbook air快捷键
  • 来源双向好友是什么意思

行业动态

企业网站建设的重要性!

现在虽然是移动互联网时代,但企业网站依然重要,包含PC站点,移动站。可以说企业网站关系企业的未来发展和前途,尤其对中小企业更是如此,一些中小企业老板,对自己的名片很在乎,因为这是个门面。...

服务项目

  • 网站建设

    查看详情
  • 移动端/APP

    查看详情
  • 微信/小程序

    查看详情
  • 技术支持

    查看详情
  • 其它服务

    查看详情
  • 更多服务项目

    用我们的专业和诚信赢得您的信赖,从PC到移动互联网均有您想要的服务!

    获取更多

联系吧 在百度地图上找到我们

电话:13518219792

如遇占线或暂未接听请拨:136xxx98888

业务咨询 技术咨询 售后服务
网站设计
四川成都网站设计
手机网站设计
外贸网站设计方案
阿坝网站设计
网站制作
成都营销网站制作
绵阳网站制作公司
网站制作
重庆网站制作
联系我们
电话:13518219792
邮箱:631063699@qq.com
地址:成都青羊区锦天国际1002号
网址:www.gydahua.com
网站建设
邛崃网站建设
成都网站建设哪家好
营销型网站建设
响应式网站建设

微信二维码

  • 友情链接
  • 做网站
  • 公司宣传册设计
  • 成都柴油发电机租赁
  • 昆明卫生洁具批发
  • 不锈钢雕塑案例
  • zaowang.cn
  • 成都柴油发电机维保
  • 成都400电话
  • 昆明木门销售
  • 乐器用品公司

Copyright © 2002-2023 www.gydahua.com 快上网建站品牌 QQ:244261566 版权所有 备案号:蜀ICP备19037934号

  • 在线咨询
  • 13518219792
  • 微信二维码

  • 移动版官网