Posted By

maturanti19 on 05/22/19


Tagged

random and of using out flag Tkinter ovals


Versions (?)

Vlajka z kruzkov


 / Published in: Python
 

Vytvorte vlajku z krúžkov rôznych velkostí Create a flag using random sizes of ovals

  1. import tkinter
  2. from random import *
  3. canvas=tkinter.Canvas(width=1000, height=800)
  4. canvas.pack()
  5.  
  6. def kruzokzlty():
  7. for i in range(6000):
  8. x=randrange(10, 800)
  9. y=randrange(10, 600)
  10. d= randrange(5, 80)
  11. canvas.create_oval(x, y, x + d, y + d, fill='yellow')
  12. kruzokzlty()
  13.  
  14. def kruzokmodry():
  15. for i in range(1000):
  16. x= randrange(200, 250)
  17. y=randrange(10, 600)
  18. d= randrange(5, 80)
  19. canvas.create_oval(x, y, x + d, y + d, fill='blue')
  20. for i in range (1500):
  21. x= randrange(10, 800)
  22. y= randrange(250, 300)
  23. d= randrange(5, 80)
  24. canvas.create_oval(x, y, x + d, y + d, fill='blue')
  25. kruzokmodry()

Report this snippet  

You need to login to post a comment.