Jump_off_a_cliff

Weird Rainbow Thing Github Copilot Made

May 28th, 2022 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. '''
  2. The following contains bright, flashing lights and/or
  3. imagery that may cause discomfort and/or seizures for
  4.      those with photosensitive epilepsy.
  5.         Viewer discretion is advised.
  6. '''
  7.  
  8. # Import the necessary modules
  9. import tkinter as tk
  10. import random
  11.  
  12. # Create a window
  13. root = tk.Tk()
  14.  
  15. # Create a canvas
  16. canvas = tk.Canvas(root, width=500, height=500)
  17. canvas.pack()
  18.  
  19. # Create a list of colors
  20. colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
  21.  
  22. # Create a loop to create a rainbow
  23. for i in range(500):
  24.     # Create a random color
  25.     color = random.choice(colors)
  26.     # Create a rectangle
  27.     canvas.create_rectangle(0, 0, i, 500, fill=color)
  28.     # Refresh the window
  29.     root.update()
  30.     # Pause for 1/100 second
  31.     root.after(10)
  32.  
  33. # End the program
  34. root.mainloop()
  35.  
  36. # End of file
  37.  
Add Comment
Please, Sign In to add comment