In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to draw pictures through the python-turtle library. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1 figure 1
The first picture is mosquito-repellent incense. Interested partners can try to draw it with the turtle library in python.
The specific code is as follows:
# painting mosquito-repellent incense import turtleturtle.pensize (30) for i in range (30): turtle.circle (iMOS 10) turtle.done () 2 figure 2
The second picture is a variant of mosquito-repellent incense. How to change the color and shape of mosquito-repellent incense by adjusting the code to draw the following figure?
The specific code is as follows:
Import turtlet = turtle.Turtle () t.pensize (2) t.color ('violet') for i in range (90): t.circle (iMagne 60) 3 figure 3
The third picture is a cobweb map, but different parts have different colors, you can also try to change to other colors.
The specific code is as follows:
# draw cobwebs from turtle import * speed (0) t = 1for i in range (100): if t = 1: color ('darkviolet') fd (2onomi) rt (61) t + = 1 elif t = 2: color (' green') fd (2onomi) rt (61) t + = 1 else: color ('yellow') Fd (2chimi) rt (61) t = 14 figure 4
The fourth picture is the Olympic rings.
The specific code is as follows:
# draw Olympic rings import turtleturtle.width (5) # control brush width colors = ['blue',' black', 'red',' yellow', 'green'] for i in range (5): turtle.color (colors [I]) # control brush color turtle.circle (50) # control circle size, radius turtle.penup () # Let brush lift if I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.