Reputation: 828
I posted a similar question a while ago but haven't received any answers so i thought i might ask a more generic question:
Does anyone know how to, through any means, output true video, not a rapidly changing sequence of images, in a Tkinter window with python?
Upvotes: 3
Views: 3626
Reputation: 60
Python tkinter can now play videos within the UI with sound,check this module:tkintervideo.
This is done with the help of many modules,so it now supports seeking and forwarding/back-warding options.
from tkintervideo import player
from tkintervideo.tools import Controls
import tkinter as tk
from tkinter import ttk
import sv_ttk
import time
class App(tk.Tk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
sv_ttk.set_theme('dark')
self.m_widget = player.Player(self,height=200,width=300)
self.rowconfigure(0,weight=1)
self.rowconfigure(1,weight=0)
self.columnconfigure(0,weight=1)
self.m_widget.grid(column=0,row=0,sticky=tk.NSEW,padx=5,pady=5)
self.m_widget.load('output.avi')
self.controls = Controls(self,self.m_widget)
self.m_widget.bind("<<Duration>>",self.controls.update_scale)
self.controls.grid(column=0,row=1,sticky=tk.NSEW,padx=10,pady=10)
myApp = App()
myApp.mainloop()
If any errors occur add it to the github issues of the project.
Upvotes: 0
Reputation: 7247
You probably need an extension like TkVideo or Quicktime to do that, not sure there is a python style wrapper for it available yet. https://github.com/patthoyts/tkvideo
Upvotes: 3