用Tkinter打造GUI开发工具(35)Tkinter中的视频播放组件

上一篇我们介绍在Tkinter中用OpenCV组件来播放MP4文件,可是OpenCV组件不支持音频,只能看无声视频。
这一篇我们介绍在Tkinter中的视频播放组件HP_mplay。这个也是HP_tk2下的一个子模块。这个模块可以实现在Tkinter中播放网络视频或网络音乐,播放本地视频也是可以的。
下面给出演示程序代码。

import  tkinter  as  tk   #导入Tkinter
import HP_mplay as hmv

root=tk.Tk()
root.title('Tkinter中的有声视频播放演示') 
root.geometry('{}x{}+{}+{}'.format(800, 600, 100, 200))
mv2= hmv.playFrame(root,file='.\\temp\\01.mp4')
mv2.create_control_view()
mv2.pack(expand = 1, fill = tk.BOTH)

root.mainloop()

下面给出程序运行结果。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/hepu8/article/details/106323691