Mundo em Python

Analisador de Textos

from tkinter import *
root = Tk()
root.title("Analisador de Textos")
root.resizable(0,0)
root.geometry("600x300")
root.config(bg="#cfe2f3")
def app():
t = texto.get()
texto_maiuisculas = t.upper()
texto_minusculas = t.lower()
numero_letras = len(t)
mensagem = f'TEXTO EM MAIÚSCULAS: {texto_maiuisculas}\n' \
f'TEXTO EM MINÚSCULAS: {texto_minusculas}\n' \
f'Número de Letras: {numero_letras}'
resultado.set(mensagem)
def limpar():
texto_entrada.delete(0, END)
titulo = Label(text="Analisador de Textos",bg="#cfe2f3",fg="#ba990a",
font=("Arial","12","bold"))
titulo.place(relx=0.35,rely=0.05) Digite_texto = Label(text="Digite o Texto: ",bg="#cfe2f3",fg="#ba990a",
font=("Arial","12","bold"))
Digite_texto.place(relx=0.15,rely=0.25) texto = StringVar()
texto_entrada= Entry(textvariable=texto,font=("Arial","12","bold"),
bg="white",fg="blue",justify='center')
texto_entrada.place(relx=0.55,rely=0.25,relwidth=0.35) #
but1 = Button( text="Analisar texto", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'),command= app)
but1.place(relx=0.15, rely=0.4, relwidth=0.3, relheight=0.1) but_limpar = Button( text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 10, 'bold'),command= limpar)
but_limpar.place(relx=0.55, rely=0.4, relwidth=0.3, relheight=0.1) resultado = StringVar()
resulatdoresultado =Label(textvariable=resultado,
font=("Arial",12,"bold"),bg="#f0f8ff")
resulatdoresultado.place(relx=0.05,rely=0.6,relwidth=0.9) root.mainloop()
0