如何杀死鳗鱼python中的线程

时间:2020-05-13 07:45:34

标签: python eel

我正在制作一个鳗鱼项目,在该项目中,我需要在单击按钮时在单独的线程中运行一个函数,并且再次需要在单击停止按钮时关闭正在运行的线程(示例代码)

def run_thread():
    while True:
        print("thread")
        eel.sleep(1.0)                  

@eel.expose
def start_btn():
   eel.spawn(run_thread)

@eel.expose
def stop_btn():
   ***close running thread here***

eel.start('main.html', block=False)

我找不到任何与鳗鱼记录相关的东西,也有一种方法可以使用python线程模块代替eel.spawn来实现相同的目的

0 个答案:

没有答案