The easiest solution I think is to make the tkinter window fullscreen rather then making the vlc instance fullscreen. So you embed it, and then when you want fullscreen, just removing everything else from the window, set the window to full screen, and set the frame with the video to match the size of the root window.
Here's the code, with some comments in between to explain it:
from tkinter import (
Tk, Menu, Frame, Label, Button, Scale, Toplevel,
BOTH, Entry, DISABLED, END, HORIZONTAL, VERTICAL
)
from vlc import Instance
class Test:
def __init__(self):
self.Instance = Instance()
self.player = self.Instance.media_player_new()
self.full_screen = 0
self.root = Tk()
self.defaultbg = self.root.cget('bg') #this line of code is to get the default background
#colour for the purpose of changing it between black and default
self.root.geometry("800x800")
self.frame = Frame(self.root, width=700, height=600)
self.frame.pack()
#the above frame is for the purpose of embedding the video in non-fullscreen
self.root.bind('<space>', self.toggle_pause)
self.root.bind('<Escape>', self.toggle_FullScreen)
self.button_frame = Frame(self.root)
self.button_frame.pack()
#the above frame is for the purpose of butting multiple widgets into
#one frame that can be easily hidden and viewed again
self.button1 = Button(
self.button_frame, text="OK",
command=self.play)
self.button1.pack(side='left')
#button to play the video
self.button2 = Button(
self.button_frame, text="Full Screen",
command=self.toggle_FullScreen)
self.button2.pack(side='left')
#button to toggle fullscreen
self.display = Frame(self.frame, bd=4)
self.display.place(relwidth=1, relheight=1)
#the above display is to adapt the size of the video to the frame
#so that a bigger frame can hold a bigger video
self.root.mainloop()
def play(self):
Media = self.Instance.media_new('/home/balthazar/test.webm')
self.player.set_xwindow(self.display.winfo_id())
#setting the xwindow is for embedding the video
self.player.set_media(Media)
self.player.play()
def toggle_FullScreen(self, event=False):
if self.full_screen == 0 and event==False:
self.full_screen = 1
self.button_frame.pack_forget()
#pack forget removes the buttons from view
self.display.config(background="black")
self.frame.pack_forget()
self.frame.place(relwidth=1, relheight=1)
#to make the frame fulscreen it must be unpacked and then placed
self.root.attributes("-fullscreen", True)
elif event and self.full_screen==1:
self.frame.place_forget()
self.frame.pack()
self.button_frame.pack()
self.full_screen = 0
self.display.config(background=self.defaultbg)
self.root.attributes("-fullscreen", False)
def toggle_pause(self, event):
pause = self.player.is_playing()
self.player.set_pause(pause)
def main():
Test()
if __name__ == '__main__':
main()