Posted By

maturanti19 on 05/22/19


Tagged

python random a z Tkinter latter rebrik luce rohu graficke


Versions (?)

rebrik a luce


 / Published in: Python
 

Vytvorte rebrik a luce z rohu obrazovky

  1. import tkinter
  2. from random import *
  3.  
  4. canvas = tkinter.Canvas(height=800, width=800, bg='gainsboro')
  5. canvas.pack()
  6.  
  7. #rebrik
  8. def rebrik1(x,y):
  9. canvas.create_line(x,y,x+125,y+200)
  10.  
  11. for i in range(2):
  12. x=100*i
  13. y=100
  14. rebrik1(x+45,y+50)
  15.  
  16. def rebrik2(x,y):
  17. canvas.create_line(x+100,y,x,y+20)
  18.  
  19. for i in range(5):
  20. x=25*i
  21. y=40*i
  22. rebrik2(x+50, y+150)
  23.  
  24. #z rohu a zo stredu skarede luce
  25. x=700
  26. y=50
  27. for i in range (1,50):
  28. x=x
  29. y=10*i
  30. canvas.create_line(x, 10, 10, y, fill='indigo')
  31. canvas.after(0)
  32.  
  33. x=400
  34. y=400
  35. for i in range (1,50):
  36. x=x
  37. y=250+i*10
  38. canvas.create_line(500, 100, y, 50, fill='blue')
  39. canvas.after(0)

Report this snippet  

You need to login to post a comment.