python-eel/Eel

implementing multithreading

Open

#444 geöffnet am 15. Feb. 2021

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (570 Forks)batch import
help wanted

Repository-Metriken

Stars
 (5.980 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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]

Contributor Guide