Blinking text in Tkinter / Collateral effect

1

Hello, I'm starting my studies in Python with the use of Tkinter. Get light on the answers / critics (rs!).
I need to "blink" a text (blink), with a value, when it is the fastest (lap record). I searched for information in various places on how to do this in a simple way, but only found results using the ".after" method. However, a side effect has arisen, doing so. After a few blinks, it slows down. My doubts are:
1) Is something wrong the way I did?
2) Is there another way to make a text flash?

Below is a summary of what I did, presenting the problem ("blinking" getting slow).

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()
    
asked by anonymous 17.12.2017 / 13:48

0 answers