1import tkinter as tk, threading
2import imageio
3from PIL import Image, ImageTk
4
5video_name = "test.mkv" #This is your video file path
6video = imageio.get_reader(video_name)
7
8def stream(label):
9
10 for image in video.iter_data():
11 frame_image = ImageTk.PhotoImage(Image.fromarray(image))
12 label.config(image=frame_image)
13 label.image = frame_image
14
15if __name__ == "__main__":
16
17 root = tk.Tk()
18 my_label = tk.Label(root)
19 my_label.pack()
20 thread = threading.Thread(target=stream, args=(my_label,))
21 thread.daemon = 1
22 thread.start()
23 root.mainloop()