浪漫星空python

代码如下:

from turtle import*
from random import*
def star():
    speed(1000)
    pencolor('#B7C5D2')
    fillcolor('#B7C5D2')
    begin_fill()
    n=randint(3,10)
    for i in range(5):
        fd(n)
        rt(144)
    end_fill()
def move(x,y):
    pu()
    goto(x,y)
    pd()
def starry_sky():
      setup(800,400)
      hideturtle()
      bgpic('xingkong.gif')
      for i in range(100):
        starx=randint(-400,400)
        stary=randint(-200,200)
        move(starx,stary)
        star()
starry_sky()

你可能感兴趣的:(python)