简体   繁体   English

Tkinter 中的 MoviePy/ffmpeg 进度条

[英]MoviePy/ffmpeg Progress Bar in Tkinter

MoviePy has a text-based progress indicator in my Sublime Text console. MoviePy 在我的 Sublime Text 控制台中有一个基于文本的进度指示器。 It looks like this:它看起来像这样:

  0%|          | 0/121 [00:00<?, ?it/s]
  4%|4         | 5/121 [00:00<00:02, 42.43it/s]
  8%|8         | 10/121 [00:00<00:02, 43.69it/s]
 12%|#2        | 15/121 [00:00<00:02, 43.52it/s]
 17%|#6        | 20/121 [00:00<00:02, 43.78it/s]

I want to pipe that progress to a text widget that I made in TKinter.我想将该进度传送到我在 TKinter 中制作的文本小部件。 I figured out how to send stdout to the textwidget, but these progress updates stay in Sublime.我想出了如何将标准输出发送到 textwidget,但这些进度更新保留在 Sublime 中。

Any input would be greatly appreciated.任何输入将不胜感激。 Thank you!谢谢!

you should check in stderr instead of stdout你应该检查 stderr 而不是 stdout

here is a good example , just keep it in mind that you should replace the line sys.stdout = pl to sys.stderr = pl这是一个很好的例子,请记住,您应该将sys.stdout = pl行替换为sys.stderr = pl

also insert a delete call befor the line self.textbox.insert(tk.END, text) would be niceself.textbox.insert(tk.END, text)行之前插入一个delete调用会很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM