当前位置: 移动技术网 > IT编程>脚本编程>Python > python画iPhone手机,这种操作有几个人见过?

python画iPhone手机,这种操作有几个人见过?

2018年10月27日  | 移动技术网IT编程  | 我要评论

林婉霞,艾滋病毒能活多久,韩国天气预报查询15天

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

python画iphone手机,这种操作有几个人见过?

 

环境准备

运行平台: windows

python版本: python 3.6.4

ide: pycharm或自带的idle

绘制代码(私人微信mmp9972,可以一起交流python,送python学习资料!)

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()

运行结果:

python画iphone手机,这种操作有几个人见过?

 

缩略图:

python画iphone手机,这种操作有几个人见过?

 

大声告诉我,这种教程你以前见过吗?

python画iphone手机,这种操作有几个人见过?

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网