python ffmpeg 多线程,解决界面卡死问题

1,002 阅读1分钟
import threading

# 点击提交执行的功能
def executeit():
    hint.set('converting . . .')
    convert(pathin.get(), pathout.get(), aimf.get())
    hint.set('convert finished')

# 创建线程执行程序
def thread_it(func, *args):	# 传入函数名和参数
    # 创建线程
    t = threading.Thread(target=func, args=args)
    # 守护线程
    t.setDaemon(True)
    # 启动
    t.start()
    
# 提交按钮
# tk.Button(window, text='提交', command=executeit).place(x=200, y=190)	# 普通执行
tk.Button(window, text='提交', command=lambda:thread_it(executeit)).place(x=200, y=190)	# 通过另外线程执行