Stack Exchange
How to get circles to appear over the video in canvas tkinter?
I have the below code:
import tkinter as tk, threading
from tkinter import *
import imageio
from PIL import Image, ImageTk
from random import *

video_name = "video.mp4" #This is your video file path
video = imageio.get_reader(video_name)

def stream(label):

for image in video.iter_data():
    frame_image = ImageTk.PhotoImage(Image.fromarray(image))
    label.config(image=frame_image)
    label.image = frame_image

def circle():
    global circ
    x = randint(0, 299)
    y = randint(0, 299)
    diameter = randint(10, 100)
    circ = canvas.create_oval(x, y, x + diameter, y + diameter, tags="circle")
    canvas.tag_raise(circ)

if __name__ == "__main__":

    root = tk.Tk()
    canvas = Canvas(root, bg="green")
    canvas.pack(expand=True, fill=BOTH)
    my_label = tk.Label(canvas)
    my_label.pack()
    b = Button(canvas, text="Circle", command=circle)
    b.pack()
    thread = threading.Thread(target=stream, args=(my_label,))
    thread.daemon = 1
    thread.start()
    root.mainloop()

It works fine, and the circles appear, but they go behind the video playing. How can I make the circles appear on top of the video?
Thanks!

Why are you calling .pack on widgets that are inside a tk.Canvas? Also you shouldn't call any tkinter methods from other threads.

You will need to use a text item on the canvas rather than a label. The canvas does not allow you to draw on top of widgets embedded in or on the canvas.
