如何在PySide2小部件内添加moviepy预览窗口

问题描述 投票:0回答:1

这是非常简单的问题。我正在使用moviepy生成视频,最后在PySide2小部件中预览了视频片段。但是,当我尝试运行videoClip.preview()时,它只是创建一个新窗口并对其进行预览。我们可以在PySide2内进行预览吗?

谢谢

python-3.x video preview pyside2 moviepy
1个回答
0
投票

就像ekhumoro所说,不确定PySide2是否可以很好地处理以下解决方案,但是无论如何,您都应该尝试一下:

生成Moviepy查看器后,写:

# create a widget which will contain your external viewer :
container_widget = QtWidgets.QWidget()

# retrieve programmatically your external viewer (works for Windows OS only) :
hwnd = win32gui.FindWindow(None, "Name_of_your_external_window_viewer") 

# embed it inside your widget :
window = QtGui.QWindow.fromWinId(hwnd)
windowcontainer = createWindowContainer(window, container_widget)

# then you want to add your windowcontainer inside a certain layout of your GUI:
gridLayout.addWidget(windowcontainer, 0, 0, 1, 1)
© www.soinside.com 2019 - 2024. All rights reserved.