video not playing inside the same tkinter, it should play the video and have any buttons below the video, it should also be able to adjust itself automatically if the user drag the windows or changes it size. improve my code:
import random
import threading
import tkinter as tk
from tkinter import filedialog
import pygame
import vlc

def play_metronome():
    # This function plays a metronome sound at a random BPM between 30 and 150
    bpm = random.randint(30, 150)
    interval = 60 / bpm
    pygame.mixer.music.load("I:/metronome.wav")
    pygame.mixer.music.play()
    threading.Timer(interval * 5, play_metronome).start()

def play_video():
    # This function opens a file dialog to select a video file and plays it using VLC
    video_file = filedialog.askopenfilename(filetypes=[("Video files", "*.mp4;*.avi;*.mkv")])
    media = vlc.Media(video_file)
    player.set_media(media)
    player.set_hwnd(video_panel.winfo_id())  # Set the window handle for video rendering
    player.play()

def stop_video():
    # This function stops the video playback
    player.stop()

# Initialize Pygame mixer
pygame.mixer.init()

# Create the main window and set its title
root = tk.Tk()
root.title("Beat Hero")

# Create the video panel as a child of the main window
video_panel = tk.Frame(root)
video_panel.pack()

# Create the Play and Stop buttons and add them to the window
play_button = tk.Button(root, text="Play Video", command=play_video)
play_button.pack()
stop_button = tk.Button(root, text="Stop Video", command=stop_video)
stop_button.pack()

# Create a VLC media player
player = vlc.MediaPlayer()

# Start the metronome thread
metronome_thread = threading.Thread(target=play_metronome, daemon=True)
metronome_thread.start()

# Run the main loop of the window
root.mainloop()