Commit bb60e2cd by BellCodeEditor

auto save

parent c6188a1e
Showing with 56 additions and 6 deletions
import pygame import ?
# 初始化pygame,为使用pygame做准备 pen = turtle.?()
pygame.init() pen.color('sienna')
w = turtle.?() # 画布
w.bgcolor('wheat') # wheat小麦
# 创建一个窗口 pen.left(90)# 移动到起点
?? pen.up()
\ No newline at end of file pen.backward(150)
pen.down()
def tree(?):# 画树枝
if n ?:
pen.forward(?)
pen.right(30)
tree(?)
pen.left(?)
tree(?)
pen.right(30)
pen.up()
pen.backward(?)
pen.down()
? # 调用函数
? # 固定画布
import turtle
pen = turtle.Turtle()
pen.color('sienna')
pen.speed(100)
w = turtle.Screen()# 画布大小
w.bgcolor('wheat') # wheat小麦
pen.left(90)# 移动到起点
pen.up()
pen.backward(150) # 后退
pen.down()
def tree(n): # 画树枝
if n>=30:
pen.forward(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
pen.right(30)
pen.up()
pen.backward(n)
pen.down()
tree(100)
turtle.done()
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