python-eel/Eel

implementing multithreading

Open

#444 aperta il 15 feb 2021

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)Python (570 fork)batch import
help wanted

Metriche repository

Star
 (5980 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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]

Guida contributor