当前位置:   article > 正文

浪漫星空python_python浪漫星空代码

python浪漫星空代码

代码如下:

  1. from turtle import*
  2. from random import*
  3. def star():
  4. speed(1000)
  5. pencolor('#B7C5D2')
  6. fillcolor('#B7C5D2')
  7. begin_fill()
  8. n=randint(3,10)
  9. for i in range(5):
  10. fd(n)
  11. rt(144)
  12. end_fill()
  13. def move(x,y):
  14. pu()
  15. goto(x,y)
  16. pd()
  17. def starry_sky():
  18. setup(800,400)
  19. hideturtle()
  20. bgpic('xingkong.gif')
  21. for i in range(100):
  22. starx=randint(-400,400)
  23. stary=randint(-200,200)
  24. move(starx,stary)
  25. star()
  26. starry_sky()

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/127390
推荐阅读
相关标签
  

闽ICP备14008679号