Advertisement
here2share

# tk_radial_gradient.py

May 3rd, 2023
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. # tk_radial_gradient.py
  2.  
  3. from tkinter import *
  4. import time
  5.  
  6. ww = 600
  7. hh = 600
  8.  
  9. root = Tk()
  10. root.title('tk_radial_gradient')
  11. root.geometry(f'{ww}x{hh}+0+0')
  12.  
  13. canvas = Canvas(root, width=ww, height=hh, bg='black')
  14. canvas.pack()
  15.  
  16. x = ww//2
  17. y = hh//2
  18. gradient = 0
  19. radius = 255 + 1
  20. while gradient < 256:
  21.     color = f"#00{gradient:02x}00"
  22.     canvas.create_oval(x - radius, y - radius, x + radius, y + radius, fill=color, outline="")
  23.     gradient += 1
  24.     radius -= 1
  25.  
  26. canvas.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement