热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

python画苹果图案_如何用python画苹果?

环境准备运行平台:WindowsPython版本:Python3.6.4IDE:Pycharm或自带的IDLE绘制代码impor

环境准备

运行平台: Windows

Python版本: Python 3.6.4

IDE: Pycharm或自带的IDLE

绘制代码

import turtle

def round_rectangle(length,high,cor_angle,cor_rad):

for i in range(2):

turtle.fd(high)

turtle.circle(cor_rad,cor_angle)

turtle.fd(length)

turtle.circle(cor_rad,cor_angle)

def main():

turtle.setup(1300,800,0,0)#启动窗口的大小,左上角右上角坐标

pythonsize=2

turtle.pensize(pythonsize)#运行宽度

turtle.speed(10)

turtle.seth(90)#启动时运行的方向(角度)

#最外边框

turtle.pencolor("#8E8e8e")

turtle.penup()

turtle.goto(202,-202)

turtle.pendown()

round_rectangle(244,484,90,30)

#填充

turtle.penup()

turtle.goto(200,-200)

turtle.pendown()

turtle.begin_fill()

turtle.color("#F0F0F0")

round_rectangle(240,480,90,30)

turtle.end_fill()

#手机屏

turtle.pencolor("black")#(#3000440)

turtle.penup()

turtle.goto(185,-150)

turtle.pendown()

turtle.begin_fill()

turtle.color("black")

round_rectangle(270,380,90,0)

turtle.end_fill()

#听筒

turtle.penup()

turtle.goto(80,265)

turtle.pendown()

turtle.begin_fill()

turtle.color("#9d9d9d")

round_rectangle(60,4,90,1)

turtle.end_fill()

#听筒上面的小黑

turtle.penup()

turtle.goto(55,290)

turtle.pendown()

turtle.begin_fill()

turtle.color("#3c3c3c")

turtle.circle(4,360)

turtle.end_fill()

#摄像头

turtle.penup()

turtle.goto(0,265)

turtle.pendown()

turtle.begin_fill()

turtle.color("#3c3c3c")

turtle.circle(6,360)

turtle.end_fill()

#home健

turtle.pencolor("#9d9d9d")#(#3000440)

turtle.penup()

turtle.goto(75,-185)

turtle.pendown()

turtle.circle(25,360)

#home健图案

turtle.pencolor("#9d9d9d")#(#3000440)

turtle.penup()

turtle.goto(60,-190)

turtle.pendown()

turtle.hideturtle()

main()

运行结果:

t0141d2dbfb408e07f2.png



推荐阅读
author-avatar
手机用户2502871761
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有