0

i want the stars to appear in the night, but it only come out one?? can anyone help me what i should do to make about 50 stars randomly appear in the night?? thank you so much!

from graphics import *
import random
def stars(x,y):
    '''draw white line representing one stars of the night.'''
    stars=Line(Point(x,y), Point(x,y))
    stars.setOutline("white")
    stars.setFill("white")
       
for i in range(50):
                    '''stars shining in the night.'''
                    x=random.randrange(60,190)
                    y=random.randrange(310,900)

                    s= Line(Point(140, 160), Point(60, 140))
                    s1= Line(Point(60, 140), Point(140, 140))
                    s2= Line(Point(140, 140), Point(60, 160))
                    s3 = Line(Point(100,120), Point(60,160))
                    s4 = Line(Point(100,120), Point(140,160))
                    s.setFill('white')
                    s.draw(win)
                    s1.setFill('white')
                    s1.draw(win)
                    s2.setFill('white')
                    s2.draw(win)
                    s3.setFill('white')
                    s3.draw(win)
                    s4.setFill('white')
                    s4.draw(win)
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by vegaseat
0

Don't you think you should do something with your random x, y values?
Please clean up your indentations.

Edited by vegaseat: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.