python-eel/Eel

implementing multithreading

Open

#444 创建于 2021年2月15日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Python (570 fork)batch import
help wanted

仓库指标

Star
 (5,980 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

problem I have designed an app using eel. Main webpage has option for user to choose action needed. Once he clicks his option, it opens other webpage where he submits his query. This executes python code which takes 10-15 minutes to execute and get required data. I want this call to be non blocking so that user can go back and do other tasks in the app. I tried using eel.spawn, new thread is being created but I still can't do anything till it completes execution. I want thread to execute in background so that user should be able to start new thread or do other tasks.

Code snippet(s)

import eel
def my_thread1(query1):
	print("entered eel thread")
	eel.spawn(get_data(query1))  // This process need 10-15 minutes. It executes when user submits first type of query on GUI
        eel.sleep(1.0)    

def my_thread2(query2):
	print("entered eel thread")
	eel.spawn(get_data(query2))  // This process also need 10-15 minutes. It executes when user submits second type of query on GUI

def my_thread3():
            eel.spawn(browse_results())  // This process executes when user just want to see previous results

eel.init('web')
eel.start('index.html', size=(2000,1600),app_mode=None, block=False)
while True:
    print("I'm a main loop")
    eel.sleep(1.0)    


**Desktop (please complete the following information):**
 - OS: [Ubuntu]
 - Browser [Chrome]
 - Version [Chromium]

贡献者指南