Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / level3-lesson15-diy1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit f6e82e1f authored 3 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent 32145e65 c0l1528p256a14963/T789889
Hide whitespace changes
Inline Side-by-side
Showing with 28 additions and 9 deletions
  • 2
  • my_tree.py
2 0 → 100644
View file @ f6e82e1f
This diff is collapsed. Click to expand it.
my_tree.py
View file @ f6e82e1f
import turtle import turtle # 导入turtle模块
pen = turtle.Turtle() pen = turtle.Turtle() # 创建画笔
pen.color('sienna') pen.color('sienna') # 画笔颜色
# 画布大小 # 画布大小
w = turtle.Screen() w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦 w.bgcolor('wheat') # 设置画布颜色'wheat小麦'
# 移动到起点 # 移动到起点
pen.left(90) pen.left(90) # 画笔角度左转90度
pen.up() pen.up() # 朝向正上方
pen.backward(150) # 后退 pen.backward(150) # 后退150
pen.down() pen.down() # 朝向正下方
# 画树
pen.forward(100) # 向前移动100画出树干
# 画右边树枝并返回
pen.right(30) # 向右旋转30度
pen.forward(50) # 前进50
pen.up() # 画笔抬起
pen.backward(50) # 原路返回50,退回交叉点
pen.down() # 画笔落下
# 画左边树枝并返回
pen.left(60) # 向左旋转60度
pen.forward(50) # 向前移动50
pen.up() # 画笔抬起
pen.backward(50) # 原路返回50,退回交叉点
pen.down() # 画笔落下
# 树干返回
pen.right(30) # 向右旋转30度
pen.up() # 画笔抬起
pen.backward(100) # 原路返回100
pen.down() # 画笔落下
turtle.done()
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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