from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Stop")
titulo = Label(root, text="Stop",
font=("Arial", 28, "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.35, rely=0.05)
tempo_piscar = 500
def piscar():
but1.config(state=DISABLED)
if texto_sub2.cget("bg") == "red":
texto_sub2.config(bg="white", fg="black")
else:
texto_sub2.config(bg="red", fg="white")
if but2["state"] == "normal":
root.after(tempo_piscar, piscar)
else:
but1.config(state=DISABLED)
def bloquear():
but1.config(state=NORMAL)
texto_sub2.config(bg="white", fg="black")
but1 = Button(root, text="Stop", bd=2, bg='red', fg='white',
font=('Verdana', 12, 'bold'), command=piscar)
but1.place(relx=0.1, rely=0.25, relwidth=0.25, relheight=0.1)
but2 = Button(root, text="Motoristas Bloquear", bd=2, bg='yellow', fg='white',
font=('Verdana', 12, 'bold'), command=bloquear, state=NORMAL)
but2.place(relx=0.5, rely=0.25, relwidth=0.45, relheight=0.1)
texto_sub2 = Label(root, text="Parar",
font=("Arial", 18, "bold"), bg="white", fg="black")
texto_sub2.place(relx=0.05, rely=0.5, relwidth=0.4, relheight=0.2)
root.mainloop()