600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > python代码画图案-python如何绘制iPhone手机图案?(代码示例)

python代码画图案-python如何绘制iPhone手机图案?(代码示例)

时间:2020-04-10 04:14:06

相关推荐

python代码画图案-python如何绘制iPhone手机图案?(代码示例)

本篇文章给大家带来的内容是介绍python如何绘制iPhone手机图案?(代码示例)。有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助。

虽然我用不起苹果手机,但我可以用python画出来!

环境准备

运行平台: 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()

运行结果:

缩略图:

阅读全文

0 个人已赞赞一个收藏 (0)打赏

您入群打赏务必备注QQ号

支付宝扫一扫赞助

微信钱包扫描赞助

分享到:

生成海报

评论 抢沙发

评论前必须登录!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。