当前位置:网站首页>Can you draw with turtle?
Can you draw with turtle?
2022-07-03 22:16:00 【White speed Dragon King's review】
1. Draw a color gradient circle
import turtle
t = turtle.Pen()
t.pensize(3)
for x in range(360):
t.pencolor(1, 0, x * 1.0 / 360.0)
t.forward(1)
t.left(1)
Draw a cute little house
import turtle
import math
t = turtle.Pen()
t.pensize(3)
# the main part of the building
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(200)
# the sloped roof
t.left(90)
t.forward(50)
t.right(135)
t.forward(150 * math.sqrt(2))
t.right(90)
t.forward(150 * math.sqrt(2))
t.right(135)
t.forward(180)
# go to the window
t.penup()
t.right(90)
t.forward(30)
t.pendown()
# draw the window
t.right(90)
t.forward(60)
t.left(90)
t.forward(60)
t.left(90)
t.forward(60)
t.left(90)
t.forward(60)
3. Draw a spiral maze
import turtle
t = turtle.Pen()
t.pensize(3)
for x in range(1,31):
t.right(90)
t.forward(x * 5)
summary :
turtle It's a painting artifact
边栏推荐
- DOM light switch case
- Data consistency between redis and database
- JS Demo calcule combien de jours il reste de l'année
- WFC900M-Network_ Card/Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-900M-high-power-Mini-PCIe-Wi-Fi-Mod
- Development mode and Prospect of China's IT training industry strategic planning trend report Ⓣ 2022 ~ 2028
- The White House held an open source security summit, attended by many technology giants
- Report on the development status and investment planning trends of China's data center industry Ⓡ 2022 ~ 2028
- 2022 safety officer-a certificate registration examination and summary of safety officer-a certificate examination
- How does sentinel, a traffic management artifact, make it easy for business parties to access?
- 4. Data splitting of Flink real-time project
猜你喜欢
This time, thoroughly understand bidirectional data binding 01
Why use pycharm to run the use case successfully but cannot exit?
JS closure knowledge points essence
Bluebridge cup Guoxin Changtian single chip microcomputer -- hardware environment (I)
[secretly kill little partner pytorch20 days] - [day3] - [example of text data modeling process]
[dynamic planning] counting garlic customers: the log of garlic King (the longest increasing public subsequence)
Buuctf, misc: n solutions
Introduction to kubernetes
[template summary] - binary search tree BST - Basics
[SRS] build a specified version of SRS
随机推荐
Tkinter Huarong Road 4x4 tutorial III
国泰君安证券开户是安全可靠的么?怎么开国泰君安证券账户
[template summary] - binary search tree BST - Basics
Harbor integrated LDAP authentication
IPhone development swift foundation 09 assets
Go Technology Daily (2022-02-13) - Summary of experience in database storage selection
Rest参考
Correlation
Leetcode problem solving - 235 Nearest common ancestor of binary search tree
Report on the development strategy of China's engineering bidding agency and suggestions for the 14th five year plan Ⓙ 2022 ~ 2028
Conditional statements of shell programming
pivot ROP Emporium
How to obtain opensea data through opensea JS
[dynamic planning] counting garlic customers: the log of garlic King (the longest increasing public subsequence)
Implementation principle of inheritance, encapsulation and polymorphism
Exness: the Central Bank of England will raise interest rates again in March, and inflation is coming
2022 electrician (elementary) examination questions and electrician (elementary) registration examination
LeetCode 1646. Get the maximum value in the generated array
SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
Is the account opening of Guotai Junan Securities safe and reliable? How to open Guotai Junan Securities Account