moved tkinter mainloop in main thread