3
Hello, I’m starting my studies in Python, with the use of Tkinter. Take it easy on the answers / critics (rs!).
I need to "blink" a text (Blink), with a value, when this is the fastest (lap record).
I searched for information in several places on how to do this in a simple way, but only found results using the method ". after".
However, there was a side effect, doing so. After a few "blinks", it slows down.
My doubts are:
1) There is something wrong the way I did?
2) Has another way to make a text blink?
Below is a summary of what I did, presenting the problem ("blinking" slowing down).
from tkinter import * # Python 3
Piscando=0
class Janela_Treino:
    def __init__ (self,janela):
        janela_treino = Canvas(0, width=800, height=600, bg="black")
        def Placar():
            global Piscando
            x = 0
            while x < 4:
                if (x == 2): # Teste para piscar a posição 3
                    if Piscando == 0:
                        janela_treino.create_text(400, 75+(150*x),text="00:000", font=('Arial', 120, 'bold'), fill="black") # Esconde
                        Piscando = 1
                    else:
                        janela_treino.create_text(400, 75+(150*x),text="00:000", font=('Arial', 120, 'bold'), fill="white") # Mostra
                        Piscando = 0
                else:
                    janela_treino.create_text(400, 75+(150*x), text="00:000", font=('Arial', 120, 'bold'), fill="white") # Mostra normal
                x=x+1
            janela.after(100,Placar) # Atualiza a tela a cada 0.1 segundo                
        Placar()
        janela_treino.pack()        
root = Tk()
Janela_Treino(root)
root.mainloop()