i am making winter greeting card using grahics.py and i need to create a code to make it snow

import random
random.randint(0,199)

p = Point(random.randint(0,199),random.randint(0,199))

p.setFill('white')
p.draw(win)

so far that what i have but noting really happened please help !

thanks !

well I've never used graphics but I've used livewires;though I must admit very rarely, however maybe showing you what this "with only one falling snowflake for now" would look like with livewires:

from livewires import games

games.init(screen_width=400, screen_height=400, fps=60)

flake=games.load_image('snowflake.png',transparent=True)
cabin=games.load_image('snowy_cabin.jpg',transparent=False)

games.screen.background=cabin

class Snow(games.Sprite):
    def update(self):
        if self.bottom>games.screen.height:
            self.y=games.screen.height/20

snow=Snow(image=flake,
          x=games.screen.width/2,
          y=games.screen.height/20,
          dy=.25)

games.screen.add(snow)

games.screen.mainloop()

p = Point(random.randint(0,199),random.randint(0,199))

def main():

for i in range(10000000000):
p = Point(random.randint(0,755),random.randint(0,755))
p.draw(win)
p.setFill('white')


main()

i did this it worked but now i cant do anything else it doesnt stop when i do win.GetMouse() i need t insert text saying click anywhere to quit but it doesnt do anything...

Nothing will happen until the for() loop exits
for i in range(10000000000):

Tkinter (graphics.py is a subset of Tkinter) has the after keyword, so it would create a new snowflake after x amount of time, while the rest of the program continues to run normally. I don't know if graphics.py implements that or not.

Otherwise, use a while() loop that exits when the mouse is clicked. Some pseudo-code:

snowing = True
while snowing:
    p = Point(random.randint(0,755),random.randint(0,755))
    p.draw(win)
    p.setFill('white')
    if mouse_clicked:
        snowing=False

Thank youuu !! i made a wonderful greeting card :)

for multiple snowflakes... consider using threading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.