how to embed non-tkinter VLC player into grid of tkinter with python?
Christian Gollwitzer
auriocus at gmx.de
Thu Mar 16 03:56:25 EDT 2017
Am 16.03.17 um 05:40 schrieb Ho Yeung Lee:
> we have many TV that would like to be monitored,
>
> how to embed non-tkinter VLC player into grid of tkinter with python?
>
> below code can embeded xterm but not for VLC player
>
>
> import vlc
> from Tkinter import *
> import os
>
> root = Tk()
> for r in range(2):
> for c in range(1):
> termf = Frame(root, height=100, width=200)
> termf.pack(fill=BOTH, expand=YES)
> wid = termf.winfo_id()
> termf.grid(row=r,column=c)
> p=vlc.MediaPlayer('file:///home/martin/Downloads/autoweb.mp4')
> p.get_tk_widget().grid(row=r,column=c)
> p.play()
> #os.system('xterm -into %d -geometry 40x20 -sb &' % wid)
> os.system('vlc --no-fullscreen "file:///home/martin/Downloads/autoweb.mp4" -into %d -geometry 100x200 -sb &' % wid)
Two questions:
1) Does VLC support the -into option? I know that mplayer has such an
option, but it is called -wid, for instance
2) Maybe the window needs to be mapped before? If so, insert a
root.update() after the grid and before you try to embed.
3) It seems you try to instantiate VLC through two different mechanisms,
via the python package vlc and via an external call to os.system.
Christian
More information about the Python-list
mailing list