Mundo em Python

Contar números

from tkinter import *
root = Tk()
contador = 0
root.title("Contador")
root.geometry("300x200")
root.resizable(0,0)
def app(texto):
contador = 0
def contar():
global contador
contador = contador + 1
texto.config(text=str(contador))
texto.after(1000,contar)
contar()
butao = Button(root, width=10, text="Sair", bg="#466a8d",
font=("Arial","12","bold"),fg="white",command=root.destroy)
butao.place(relx=0.35,rely=0.65)
texto = Label(root,fg="#0c1427",font=("arial",50,"bold"))
texto.place(relx=0.45,rely=0.1)
app(texto)
root.mainloop()
0