Posted By

maturanti19 on 05/22/19


Tagged

python random text do Tkinter zapis novy kruhu vytvorte schody


Versions (?)

schody pekna vec z rohu text do kruhu stary a novy zapis


 / Published in: Python
 

Vytvorte text do kruhu a schody a obdlzniky pod seba rovnako daleko

  1. import tkinter
  2. from random import *
  3.  
  4. canvas = tkinter.Canvas(height=600, width=800, bg='gainsboro')
  5. canvas.pack()
  6.  
  7. #stary zapis
  8. x=0
  9. for i in range(1,11):
  10. x=x+20
  11. canvas.create_rectangle(x,10,x+15,20)
  12.  
  13. #novy zapis
  14. x=0
  15. for i in range(1,11):
  16. x=i+20*i
  17. canvas.create_rectangle(x,10,x+15,20)
  18.  
  19. y=10
  20. for i in range(10,16):
  21. y=y+20
  22. canvas.create_rectangle(100,y,200,y+10)
  23.  
  24. #text do kruhu
  25. x=0
  26. for i in range(1,7):
  27. t=' Python'
  28. f='Georgia 18 bold'
  29. x=x+10
  30. canvas.create_text(400,500,text=t,fill='black', angle=x*30, font=f)
  31.  
  32. #schodiky
  33. x=10
  34. y=10
  35. for i in range(0,5):
  36. x=40*i
  37. y=40*i
  38. canvas.create_line(x,y,x+40,y)
  39. canvas.create_line(x+40,y,x+40,y+40)
  40.  
  41. #ta pekna vec z rohu
  42. x=10
  43. y=10
  44. for i in range(1,26):
  45. x=x+20
  46. y=y+20
  47. canvas.create_line(x,10,510,y,fill='indigo')
  48. canvas.update()
  49. canvas.after(100)
  50.  
  51. x=10
  52. y=10
  53. for i in range(1,26):
  54. x=x+20
  55. y=y+20
  56. canvas.create_line(x, 510, 10, y, fill='indigo')
  57. canvas.update()
  58. canvas.after(100)
  59.  
  60. x=500
  61. y=10
  62. for i in range (1,26):
  63. x=x-20
  64. y=y+20
  65. canvas.create_line(x, 10, 10, y, fill='indigo')
  66. canvas.update()
  67. canvas.after(100)

Report this snippet  

You need to login to post a comment.