Commit 8691f536 by BellCodeEditor

save project

parent e84b8c67
Showing with 8 additions and 1 deletions
import turtle import turtle
import random
pen = turtle.Turtle() pen = turtle.Turtle()
pen.color('sienna') pen.color('sienna')
# 画布大小 # 画布大小
...@@ -7,6 +7,13 @@ w = turtle.Screen() ...@@ -7,6 +7,13 @@ w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦 w.bgcolor('wheat') # wheat小麦
def tree(n): def tree(n):
if n>=0: if n>=0:
if n<=12:
color_list=['snow','lightcoral']
color=random.randint(color_list)
pen.color(color)
pen.pensize(n/3)
else:
pen.color('sienna')
pen.pensize(n/10) pen.pensize(n/10)
pen.forward(n) pen.forward(n)
angle = random.randint(0,30) angle = random.randint(0,30)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment