不废话,直接上代码:文章来源:https://www.toymoban.com/news/detail-616799.html
import turtle
screen = turtle.Screen()
pen = turtle.Turtle()
pen.pensize(3)
pen.speed(10)
screen.bgcolor("black")
def fireworks():
for i in range(30):
pen.color("red")
pen.forward(200)
pen.left(170)
pen.penup()
pen.setpos(0, 0)
pen.pendown()
for i in range(30):
pen.color("yellow")
pen.forward(200)
pen.left(170)
pen.penup()
pen.setpos(0, 0)
pen.pendown()
for i in range(30):
pen.color("blue")
pen.forward(200)
pen.left(170)
pen.penup()
pen.setpos(0, 0)
pen.pendown()
for i in range(30):
pen.color("purple")
pen.forward(200)
pen.left(170)
pen.penup()
pen.setpos(0, 0)
pen.pendown()
for i in range(10):
fireworks()
screen.mainloop()
喜欢的关注下。文章来源地址https://www.toymoban.com/news/detail-616799.html
到了这里,关于python基础编程:python如何实现浪漫的烟花秀(附代码)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!