I cant update two window at the same time - countdown

Viewed 41

I am writing again because of a problem that I cannot solve, I have a main window which has a timer in a label, at the same time it starts a toplevel with another timer in other label, my idea is that the 2 timers start when you click the button on the main window, but I can't figure it out, it just starts the one in the main window.

    self.is_running=False

    self.tablero_principal = window
        self.tablero_principal.title('Tablero')

    #SECOND WINDOW TOPLEVEL
        self.control_wind = customtkinter.CTkToplevel()
        self.control_wind.title('Posesion') 


    def countdown(self,segundos,posesion):
         
            if self.is_running:       
                segundos_final=int(segundos)
                minutos_final=int(self.text_minutos.get())
                posesion_final=int(posesion)    

                self.text_minutos.set(f"{minutos_final:02d}")
                self.text_segundos.set(f"{segundos_final:02d}")
                
                if segundos_final > 0:

                    self.tablero_principal.after(1000, self.countdown, segundos_final-1,posesion_final-1) 
                 

    def iniciar(self):

            if not self.is_running:  
                self.countdown(self.text_segundos.get(),self.text_segundos_posesion.get())         

    def parar(self):
         
            self.is_running = False  

enter image description here

0 Answers
Related