当前位置:   article > 正文

Python代码~爱心表白_python爱心表白代码

python爱心表白代码
  1. import turtle
  2. import time
  3. def LittleHeart():
  4. for i in range(200):
  5. turtle.right(1)
  6. turtle.forward(2)
  7. love = input('请输入你最最想对她说的话: ')
  8. me = input('请输入她的昵称:')
  9. if love == '':
  10. love = 'I Love you'
  11. turtle.setup(width=980, height=780)
  12. turtle.color('red', 'pink')
  13. turtle.pensize(5)
  14. turtle.speed(8)
  15. turtle.up()
  16. turtle.hideturtle()
  17. turtle.goto(0, -180)
  18. turtle.showturtle()
  19. turtle.down()
  20. turtle.speed(3)
  21. turtle.begin_fill()
  22. turtle.left(140)
  23. turtle.forward(224)
  24. LittleHeart()
  25. turtle.left(120)
  26. LittleHeart()
  27. turtle.forward(224)
  28. turtle.end_fill()
  29. turtle.pensize(5)
  30. turtle.up()
  31. turtle.hideturtle()
  32. turtle.goto(0, 0)
  33. turtle.showturtle()
  34. turtle.color('#CD5C5C', 'pink')
  35. turtle.write(love, font=('黑体', 35,), align="center")
  36. turtle.up()
  37. turtle.hideturtle()
  38. time.sleep(1)
  39. turtle.goto(0, 0)
  40. turtle.showturtle()
  41. turtle.color('orange', 'pink')
  42. turtle.write(love, font=('黑体', 35,), align="center")
  43. turtle.up()
  44. turtle.hideturtle()
  45. if me != '':
  46. turtle.color('black', 'pink')
  47. time.sleep(1.5)
  48. turtle.goto(180, -180)
  49. turtle.showturtle()
  50. turtle.write(me, font=(60,), align="center", move=True)
  51. window = turtle.Screen()
  52. window.exitonclick()

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/959758
推荐阅读
相关标签
  

闽ICP备14008679号