I am trying to make an internet speedtest app using Python and Kivy, The function that gives the internet speed needs about 30 seconds to work
So in the GUI the program stops until the function return the internet speed
How can i make a loading bar that loads while the speed test function is working ?
And can I make the function print its live results in the gui with kivy?
I searched for multithreading but I am not sure about how to use it ?
Asked
Active
Viewed 43 times
0

Esra Issam
- 17
- 5
1 Answers
0
In your case I would simply start the internet speed function in another thread so GUI will not hang.
import threading
thread = threading.Thread(target=your_function, args=(function_arguments,))
thread.start()
Edit
In your case I guess you can do this
from multiprocessing.pool import ThreadPool
...
class Seventh(Widget):
def on_button_click(self):
self.count += 1
self.my_var = str(self.count)
pool = ThreadPool(1)
async_res = pool.apply_async(self.speed.download)
self.d = str(get_size(async_res.get()))
print(self.d)

imM4TT
- 292
- 1
- 8
-
how can I apply to this code I will edit the post and add the code so may you check it ! – Esra Issam Jun 29 '22 at 09:35