当前位置:网站首页>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
边栏推荐
- Why should enterprises do more application activities?
- The 14th five year plan for the construction of Chinese Enterprise Universities and the feasibility study report on investment Ⓓ 2022 ~ 2028
- Teach you how to install aidlux (1 installation)
- Leetcode problem solving - 235 Nearest common ancestor of binary search tree
- Are the top ten securities companies safe to open accounts and register? Is there any risk?
- How PHP adds two numbers
- DOM light switch case
- Leetcode problem solving - 230 The k-th smallest element in the binary search tree
- Sow of PMP
- [template summary] - binary search tree BST - Basics
猜你喜欢
Persistence of Nacos
Yyds dry inventory hcie security Day12: concept of supplementary package filtering and security policy
Preliminary analysis of smart microwave radar module
A little understanding of GSLB (global server load balance) technology
Compréhension de la technologie gslb (Global Server load balance)
How PHP adds two numbers
The latest analysis of crane driver (limited to bridge crane) in 2022 and the test questions and analysis of crane driver (limited to bridge crane)
Redis single thread and multi thread
4 environment construction -standalone ha
Teach you to easily learn the type of data stored in the database (a must see for getting started with the database)
随机推荐
2022 safety officer-b certificate examination summary and safety officer-b certificate simulation test questions
Cognitive fallacy: what is dimensional curse
IPhone development swift foundation 09 assets
string
[secretly kill little partner pytorch20 days] - [day3] - [example of text data modeling process]
Go language slice interview real question 7 consecutive questions
DR-NAS26-Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-5GHz-high-power-Mini-PCIe-Wi-Fi-Module
Why should enterprises do more application activities?
Minio deployment
Unique in China! Alibaba cloud container service enters the Forrester leader quadrant
How to obtain opensea data through opensea JS
[sg function] lightoj Partitioning Game
Are the top ten securities companies safe to open accounts and register? Is there any risk?
The 14th five year plan for the construction of Chinese Enterprise Universities and the feasibility study report on investment Ⓓ 2022 ~ 2028
Covariance
Yyds dry inventory hcie security Day12: concept of supplementary package filtering and security policy
[SRS] build a specified version of SRS
JS demo calculate how many days are left in this year
Data consistency between redis and database
Décompiler et modifier un exe ou une DLL non source en utilisant dnspy