I have created one python tkinter app using selenium and xlwings modules. complete selenium and xlwings code are inside a function and that function I am calling through a thread and getting this error: (-2147417842, 'The application called an interface that was marshalled for a different thread.', None, None) And if I don't use thread, it works fine, but Tkinter window does not respond when I try to exit. Please help me with both the solutions (If I use threading and if I don't use threading) I have tried other answers on StackOverflow but all of them were confusing.
from tkinter import *
import threading
import xlwings as xw
def start_skip():
with xw.App(visible=False) as app:
book = xw.Book(uploadEntry.get())
sheet = book.sheets['Sheet1']
address = sheet.range((excel_row, col)).value
//some selenium code to fetch data and add to excel
book.save()
book.close()
def start_thread():
t1 = threading.Thread(target=start_skip)
t1.daemon=True
t1.start()
root=Tk()
uploadEntry=Entry(root)
uploadEntry.pack()
button=Button(root,text='START',command=start_thread)
button.pack()
root.mainloop()