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

bellcode / lesson3-1-1_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
Switch branch/tag
  • lesson3-1-1_DIY1
  • diy1.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    auto save · 8e4439ca
    BellCodeEditor committed 5 years ago
    8e4439ca
diy1.py 887 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
# 利用write()帮助悟空给诺依回信吧~
#导入库
import turtle
#创建画笔
p = turtle.Pen()
#设置背景颜色
s= turtle.Screen()
#颜色为浅蓝色
s.bgcolor("light blue")


#抬笔
p.penup()
#书写字体:
p.write("XXX~\n我爱你~\n520快乐",font=("Times",13,"normal"))


#改变位置
p.goto(-100,0)
#落笔
p.pendown()
#画笔颜色
p.color("red")
#设置笔的粗细
p.pensize(5)
#整体填充颜色
p.fillcolor("red")
#开始填充
p.begin_fill()
#画出圆心:
#先旋转45度
p.left(45)
#设置弹窗
len = int(s.textinput("提示","请输入心的大小"))
#设置变量长度
# len = 70
#往前走100步
p.forward(2*len)
#画半圆,逆时针,半圆
p.circle(len,180)
#画另外一半
#先旋转方向
p.right(90)
#先画半圆
p.circle(len,180)
#直走
p.forward(2*len)
#结束填充
p.end_fill()
#画笔隐藏
p.hideturtle()
#保存画布
turtle.done()