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
    save project · e35f6f7b
    BellCodeEditor committed 4 years ago
    e35f6f7b
diy1.py 817 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
#导入模块
import turtle
#背景颜色
screen=turtle.Screen()
screen.bgcolor("blue")
#准备画笔
pen_a=turtle.Pen()
pen_a.color("black")
pen_a.speed(99)
pen_a.pensize(1)
pen_a.penup()
pen_a.goto(100,-100)
#写字
word=screen.textinput("字","写啥?")
pen_a.write(word,font=("Times",30,"normal"))
#隐藏画笔
pen_a.hideturtle()
#准备画笔
color=screen.textinput("颜色","啥色?")
pen_b=turtle.Pen()
pen_b.color(color)
pen_b.speed(99)
pen_b.pensize(1)
#画圆
len=screen.textinput("爱心大小","爱心多大?")
len=int(len)
pen_b.fillcolor(color)
pen_b.begin_fill()
pen_b.left(45)
pen_b.forward(2*len)
pen_b.circle(len,180)
pen_b.right(90)
pen_b.circle(len,180)
pen_b.forward(2*len)
pen_b.end_fill()
#隐藏画笔
pen_b.hideturtle()
#固定画布
turtle.done()