Solar System

Orbit.py:

import turtle, time, random
SS = turtle.Screen()
SS.title('Solar System')
SS.setup(500, 500)
SS.bgcolor('black')
SS.tracer(0)

earth = turtle.Turtle()
earth.shape('circle')
earth.goto(-10, 180)
earth.color('green')

moon = turtle.Turtle()
moon.shape('circle')
moon.goto(-10, 180)
moon.shapesize(0.3, 0.3)
moon.color('grey')
moon.penup()
stars=[]
for i in range(40):
    star = turtle.Turtle()
    star.shape('circle')
    star.color('white')
    star.shapesize(0.07)
    star.penup()
    star.goto(random.randint(-250, 250), random.randint(-250, 250))
    stars.append(star)
sun = turtle.Turtle()
sun.shape('circle')
sun.color('yellow')
sun.shapesize(6, 6)
sun.goto(-10,0)
global x
x = 0
global y
y = 0
def MoveSS():
    global x
    global y
    for i in range(360):
        y-=13
        moon.setheading(y)
        moon.forward(10)
        moon.setheading(x)
        moon.forward(3)
        SS.update()
        earth.setheading(x)
        earth.forward(3)
        x-=1
        time.sleep(0.03)
        SS.update()
        for i in stars:
            i.goto(i.xcor()+3, i.ycor())
        for i in stars:
            if i.xcor() > 250:
            i.goto(i.xcor()-500, random.randint(-250, 250))
while True:
    moon.goto(earth.xcor(), earth.ycor()+50)
    MoveSS()