How to make a button flash Tkinter

Asked

Viewed 74 times

1

I’m trying to make a screen where the buttons blink at certain frequencies. I couldn’t find any function that answered. Can someone help me, please?

Follow the code I’ve made for now:

from tkinter import *

janela = Tk()
janela.title("ICM")
janela["bg"] = "black"
janela.geometry("900x600+200+0") #LxA+Esq+Topo

lb1 = Button(janela, width = 30, height = 5, text = "CIMA", bg="red")
lb2 = Button(janela, width = 30, height = 5, text = "BAIXO", bg="red")
lb3 = Button(janela, width = 30, height = 5, text = "DIREITA", bg="red")
lb4 = Button(janela, width = 30, height = 5, text = "ESQUERDA", bg="red")
lb5 = Button(janela, width = 30, height = 5, text = "START", bg="white")
lb6 = Button(janela, width = 30, height = 5, text = "STOP", bg="white")

lb1.grid(row=0,column=3, padx= 100, pady=10) #cima
lb2.grid(row=5,column=3,padx= 100, pady=10) #baixo
lb3.grid(row=3,column=0,padx= 10, pady=100) #direita
lb4.grid(row=3,column=5,padx= 10, pady=100) #esquerda
lb5.grid(row=5,column=0,padx= 10, pady=100) #start
lb6.grid(row=5,column=5,padx= 10, pady=100) #stop

janela.mainloop()
  • That question has an answer here - https://answall.com/questions/263557/piscar-um-texto-tkinter-efeito-colateral/374046 - yours cannot be marked as a duplicate, as the author of the other question has not bothered to verify the answer given. But carefully: this is not done automatically by Tkinter, you have to write a callback function that changes the desired attributes,and call it with the method .after from your application’s root window.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.