I am trying to make a mailbox checker with imap lib, it work pretty fine with python, queue and multithread without gui.
But when I try to put a gui, ev
Sorry for late answer but it is a technique that can solve similar problems.
The problem is clear. The GUI freezes because its thread has to do another job. An abstracted(from the PyQt point) solution is given below:
Example Code:
class Worker(threading.Thread):
def __init__(self, queue):
super().init()
self.queue = queue
def run(self):
# Your code that uses self.queue.put(object)
class Gui:
def __init__(self):
self.timer = Qtimer()
self.timer.setInterval(milliseconds)
self.timer.timeout.connect(self.read_data)
def start_worker(self):
self.queue = queue.Queue()
thr = Worker(self.queue)
thr.start()
def read_data(self):
data = self.queue.get()
self.timer.timeout.connect registers the callback function.