You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,all of the great gods. Here's a little problem.
I want to output .mp4 movie from here, but it doesn't work.
One of My primary function is to modify the attributes of MyScene,Such as duration or color and then export animations.
And the second mind is that I don't want to load the module from '.py' file by use "manimgl manim_test.py MyScene -w"
How can I resolve this problem?
Thanks very much.
importshleximportsubprocessfromPyQt5.QtCoreimportQThread, pyqtSignalfromPyQt5.QtWidgetsimportQMainWindow, QVBoxLayout, QPushButton, QWidget, QApplicationfrommanimlibimport*classMyScene(Scene):
duration=1color='#FF0000'defconstruct(self):
dot=Dot(color=self.color)
self.add(dot)
self.play(ShowCreation(dot), run_time=self.duration)
self.wait(1)
# demo = MyScene()# demo.run()classWorker(QThread):
finished=pyqtSignal()
def__init__(self, parent=None):
super().__init__(parent)
defrun(self):
# I don't want to use this scheme# subprocess.run(shlex.split('manimgl manim_test.py MyScene -w --file_name demo_test_name'))self.finished.emit()
classMainWindow(QMainWindow):
def__init__(self):
super().__init__()
self.setWindowTitle('Animation Generator with PyQt5 and manimgl')
self.setGeometry(300, 300, 300, 200)
layout=QVBoxLayout()
self.workerThread=Worker()
self.workerThread.finished.connect(self.threadFinished)
self.generate_button=QPushButton('Generate Animation', self)
self.generate_button.clicked.connect(self.outputFile)
layout.addWidget(self.generate_button)
central_widget=QWidget()
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)
self.windowScene=MyScene()
self.windowScene.duration=2self.windowScene.color='#ff0088'self.windowScene.run() # It works.#TODO# self.windowScene.file_writer.begin() # Here try to write animations to the disk# I want to output .mp4 movie from here, but it doesn't work.# One of My primary function is to modify the attributes of MyScene,Such as duration or color.# And the second mind is that I don't want to load the module from '.py' file by use "manimgl manim_test.py MyScene -w"# How can I resolve this problem?# Thanks very much.defthreadFinished(self):
print('finish')
self.workerThread.quit()
defoutputFile(self):
print('begin')
#TODO# self.windowScene.file_writer.begin() # Here try to write animations to the disk# Export animation "self.windowScene" to hard drive# self.workerThread.start()if__name__=='__main__':
app=QApplication(sys.argv)
ex=MainWindow()
ex.show()
sys.exit(app.exec_())
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,all of the great gods. Here's a little problem.
I want to output .mp4 movie from here, but it doesn't work.
One of My primary function is to modify the attributes of MyScene,Such as duration or color and then export animations.
And the second mind is that I don't want to load the module from '.py' file by use "manimgl manim_test.py MyScene -w"
How can I resolve this problem?
Thanks very much.
Beta Was this translation helpful? Give feedback.
All reactions