Home > Enterprise >  Best way to Multi-Thread Tkinter Front End with the Back end
Best way to Multi-Thread Tkinter Front End with the Back end

Time:03-14

I have a Pandas iteration function that runs in a separate back end file from the GUI with TKinter. I understand that iteration in pandas is not really a good practice in most cases but a few. However, in my case I do need to work with the iteration.

I found out that using multi threading would help prevent the "Not Responding" on the GUI. What would be best approach at this?

I'm not sure a sample of my code is needed in this. I'm just trying to understand how applying multi threading would work in this case.

Update:

command=combine_funcs(threading.Thread(target=getattr(Backend, cmdstr)).start(),lambda i=i: dynamic_label(i)))

I think I'm getting closer to the solution which would be to apply the threading on the commands function.

I'm not able to get this to work right, Is there perhaps another way?

CodePudding user response:

My fix was to set the command to a lambda, then apply the threading. Also realized last minute I was placing the threading into the wrong button.

command=lambda : threading.Thread(target=getattr(Backend, cmdstr)).start())
  • Related