I am writing a domotic control program in Python using Tkinter library. There's a button which start a function located in a other script (which I include at the beginning).
The button works fine but it still pressed during the execution of my function, which takes some time to execute... I would put a "waiting screen" instead of just having the button pressed and the program non-responding. I join an extract of my code.
I searched everywhere but I didn't find a clear solution.
Hope you can help me !
Main script :
import backend
from tkinter import *
window = Tk()
frameMain = Frame(window)
buttonConnection = Button(frameMain, text="Connect devices", command=backend.configDevices)
frameMain.pack()
backend.py script :
pathConfip = 'assets/confip.txt'
...
def configDevices():
with open(pathConfip, 'r', encoding='utf-8') as fileConfip:
# ips are in a text file, separated by "###" each time
ip = fileConfip.read().split('###')
global bulb1, bulb2, bulb3, stripeBulb, lgtv, cast
bulb1 = Bulb(ip[0])
bulb2 = Bulb(ip[1])
bulb3 = Bulb(ip[2])
stripeBulb = Bulb(ip[3])
lgtv = WebOsClient(ip[4])
cast = Chromecast(ip[5])