I have written a python program with a PyQt GUI that, using the imaplib, checks if I have new mails, here is part of the code:
def getAccountStatus(self, accountIndex):
# some not interesting code
mail = imaplib.IMAP4_SSL(currentHost)
# some not interesting code
mail.login('user', 'pass')
mailCount = int(mail.select("INBOX", True)[1][0])
# some not interesting code
serverResponse, data = mail.uid('search', None, 'UNSEEN')
# some not interesting code
unseenUidList = data[0].split()
# some not interesting code
self.emailAccountsWidget.setText("<BR>".join(self.accountStatusString))
return [mailCount, len(unseenUidList)]
The problem is that during this process of retrieving the data from the imap server the GUI freezes, even the TextEdit (self.emailAccountsWidget) is not updating its text if I do not explicitly call the repaint event of the window. Any workarounds to avoid this?