Advertisement
here2share

# gradient_color_arc.py

Nov 16th, 2022
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. # gradient_color_arc.py
  2.  
  3. import tkinter as tk
  4. root = tk.Tk()
  5. width,height=400,220
  6. d=str(width)+"x"+str(height)
  7. root.geometry(d)
  8. canvas = tk.Canvas(root,width=width,height=height)
  9. canvas.pack()
  10. x1,y1,x2,y2=25,30,370,370
  11. arc_w=40
  12. def my_upd(d):
  13.     change=int((255/180)*d) # increment in colour value
  14.     color_c='#%02x%02x%02x' % (255-change, change,0)
  15.     return color_c
  16. res=1 # resolution or steps
  17. for d in range(0,180,res):
  18.     canvas.create_arc(x1, y1,x2,y2, start=d, extent=res+1,outline=my_upd(d),
  19.         width=arc_w,style=tk.ARC)
  20. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement