here2share

# tk_flippant_lines.py

Jan 1st, 2026
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. # tk_flippant_lines.py
  2.  
  3. import tkinter as tk
  4.  
  5. w, h = 240, 136
  6. speed_multiplier = 0.5
  7. num_speeds = 30
  8. speeds = [speed_multiplier * (0.5 + i / (num_speeds - 1) * 4.0) for i in range(num_speeds)]
  9.  
  10. l = [[w//15*j, speeds[i%num_speeds], w//15*j, speeds[(i+1)%num_speeds]] for i, j in enumerate(range(15))]
  11. c = ['#000', '#1D2B53', '#7E2553', '#008751', '#AB5236', '#5F574F', '#C2C3C7', '#FFF1E8', '#F00', '#FA0', '#FF0', '#0F0', '#0AF', '#83769C', '#F7A', '#FCA']
  12.  
  13. rr = tk.Tk()
  14. cv = tk.Canvas(rr, width=w, height=h, bg='black')
  15. cv.pack()
  16.  
  17. while 1:
  18.     cv.delete("all")
  19.     for a, b in enumerate(l):
  20.         for i in (0, 2):
  21.             b[i] += b[i+1]
  22.             if b[i] < 0 or b[i] > w: b[i+1] *= -1
  23.         cv.create_line(b[0], 0, b[2], h, width=3, fill=c[(a + 1) % 16])
  24.     cv.update()
  25.     rr.update_idletasks()
Advertisement
Add Comment
Please, Sign In to add comment