Mundo em Python

Como Cumprimentar Agora

from tkinter import *
import datetime root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Como Cumprimentar Agora") titulo = Label(text="Como Cumprimentar Agora",
font=("Arial", "20", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.05, rely=0.05) sub1 = Label(text="Nome: ", font=("Arial", "18", "bold"), bg="#103030", fg="#49e3e3")
sub1.place(relx=0.05, rely=0.25)
nome = StringVar()
nome_entrada = Entry(textvariable=nome, font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nome_entrada.place(relx=0.3, rely=0.26, relwidth=0.65)
nome_entrada.focus()
def limpar():
nome_entrada.delete(0,END)
resultado_texto.config(text="") def app():
hora_atual = datetime.datetime.now().hour
n =nome.get() if 6 <= hora_atual < 12:
saudacao= "Bom dia!"
elif 12 <= hora_atual < 18:
saudacao = "Boa tarde!"
else:
saudacao = "Boa noite!"

text=f"{saudacao}.\nSr(a).{n},obrigado por ter vindo!!"
resultado_texto.config(text=text) but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.1, rely=0.4, relwidth=0.25, relheight=0.1) but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=limpar)
but_limpar.place(relx=0.4, rely=0.4, relwidth=0.25, relheight=0.1) but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.7, rely=0.4, relwidth=0.25, relheight=0.1) resultado_texto = Label(font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.55, relwidth=0.9, relheight=0.38) root.mainloop()
0