fork download
  1. import tkinter as tk
  2. import time
  3. import threading
  4.  
  5. class Flash(threading.Thread):
  6. def run(self):
  7. time.sleep(0.5)
  8. button.config(bg='red')
  9. time.sleep(0.1)
  10. button.config(bg='lightblue')
  11. time.sleep(0.1)
  12. button.config(bg='red')
  13. time.sleep(0.1)
  14. button.config(bg='lightblue')
  15. time.sleep(0.1)
  16.  
  17.  
  18. root=tk.Tk()
  19. button=tk.Button(text='Button',bg='lightblue')
  20. button.pack()
  21.  
  22. t = Flash()
  23. t.start()
  24.  
  25. root.mainloop()
  26.  
Runtime error #stdin #stdout #stderr 0.14s 23596KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ModuleNotFoundError: No module named 'tkinter'