Posted By

maturanti19 on 05/22/19


Tagged

nahodne kruhy velkost platna urci uzivatel


Versions (?)

Canvas podla toho ake urci uzivatel a nahodne kruhy


 / Published in: Python
 

Vytvorte nahodne kruhy s tym ze velkost platna urci uzivatel

  1. from random import *
  2. import tkinter
  3. v=int(input('Ake vysoke ma byt platno? '))
  4. s=int(input('Ake siroke ma byt platno? '))
  5. canvas = tkinter.Canvas(height = v, width = s, bg='gainsboro')
  6. canvas.pack()
  7.  
  8. x=v//2
  9. y=s//2
  10. d=20
  11. r=0
  12.  
  13. if v>=s:
  14. r=s//2
  15. while r>0:
  16. canvas.create_oval(x-r,y-r,x+r,y+r, outline='black')
  17. r=r-d
  18. d=20
  19. if v<=s:
  20. r=v//2
  21. while r>0:
  22. canvas.create_oval(x-r,y-r,x+r,y+r, outline='black')
  23. r=r-d

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: milessmith on May 27, 2019

Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one. vidmate.onl
messenger
showbox.run

You need to login to post a comment.