How do I update a button when an external event occurs?

0

I made a small application where it communicates with an external drive by querying some Boolean variables. Depending on the status of these variables, a button is placed on the screen and a figure is included in this indicating the status of this unit. Ex .:

if Status_Botão_Aberto_A: 
    Photo_A = Photo_Aberto #carrega a figura referente ao status da unidade
Mais adiante: 
    A = Button(command=lambda : Comando(True, False, 1.Status_Botao_Aberto_A, Status_Botao_Fechado_A))
    A.place(x=76, y=87)m #posição do Botão
    A.config(imagem=Photo_A. width="42", height="42")
    A=Button(root)

My doubt is that to update these buttons, which are four, I have to communicate with each of the units to test the state variables. for this, I had to put before root.mainloop the command root.after(1000, Loop_interface) , where every second calls the main function.

    
asked by anonymous 06.02.2018 / 13:15

0 answers