How to draw iPhone mobile phone pattern in python? (code example)

青灯夜游
Release: 2018-10-27 16:30:29
forward
7034 people have browsed it

The content of this article is to introduce how to draw iPhone mobile phone patterns in python? (code example). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Although I can’t afford an iPhone, I can draw it using python!

How to draw iPhone mobile phone pattern in python? (code example)

Environment preparation

Running platform: Windows

Python version: Python 3.6 .4

IDE: Pycharm or the built-in IDLE

Drawing code

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()
Copy after login

Running results:

How to draw iPhone mobile phone pattern in python? (code example)

Thumbnail:

How to draw iPhone mobile phone pattern in python? (code example)

The above is the detailed content of How to draw iPhone mobile phone pattern in python? (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!