How to get text and other elements to display over the Video in Tkinter?

36 Views Asked by At
import tkinter as tk
from tkvideo import tkvideo

root = tk.Tk()

root.geometry("957x555")
root.configure(bg = "#FFFFFF")
root.attributes('-alpha', 0.8)

canvas = tk.Canvas(
    root,
    bg="#FFFFFF",
    height=555,
    width=957,
    bd=0,
    highlightthickness=0,
    relief="ridge"
)
canvas.place(x = 0, y = 0)

canvas.create_rectangle(
    52.976036673451745,
    41.0,
    69.0,
    512.0,
    fill="#FFFFFF",
    outline="")

canvas.create_rectangle(
    854.9753520069789,
    24.0,
    871.0,
    508.0,
    fill="#FFFFFF",
    outline="")

canvas.create_text(
    247.0,
    250.0,
    anchor="nw",
    text="Test",
    fill="#FFFFFF",
    font=("Inter Medium", 24 * -1)
)

lbl = tk.Label()
player = tkvideo("Files/0001-1000.mp4", lbl, loop=1, size=(957,555),)
player.play()

lbl.pack()
canvas.pack()
root.resizable(False, False)
root.mainloop()

I've used Tkvideo to create a video playing infinitely in the back. I've tried to make the video both as a part and not a part of the canvas and moving around the elements but it seems they aren't being displayed. I want some text to be visible in the front but Its not working. Can someone help?

0

There are 0 best solutions below