Answer the question
In order to leave comments, you need to log in
Why are functions run sequentially and not in parallel?
My challenge is to run two functions at the same time. I used threading library. After launch, the main window opens, but another function (get_mail_func()) is only run when the main window is closed, at the very end. What is the problem?
Here is a code snippet:
if __name__ == '__main__':
get_mail_class_start = get_mail_class(imaplib.IMAP4_SSL('imap.gmail.com') )
root = tk.Tk()
db = DB()
app = Main(root, '**********')
root['bg'] = '#2A3132'
def all_tkin():
app.pack()
root.title('Main')
root.geometry('1000x700')
root.resizable(False,False)
root.mainloop()
init_app_thread = threading.Thread(target = all_tkin(), args = ())
init_mail_thread = threading.Thread(target = get_mail_class_start.get_mail_func() , args = ())
init_app_thread.start()
init_mail_thread.start()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question