from tkinter import *
root=Tk()
root.title("Inteiros em Horas")
root.geometry("500x300")
root.resizable(0,0)
root.configure(bg="#cfe2f3")
def mostrar():
n = numero.get()
horas= str(n)[:2] + 'h' + str(n)[2:] + 'min'
vresultado.set(horas)
def limpar1():
numero_entrada.delete(0, END)
text_numero = Label(text="Digite o número: ",
font=("Ariel","12","bold"),bg="#cfe2f3")
text_numero.place(relx=0.15,rely=0.2,relwidth=0.3)
numero = IntVar()
numero_entrada= Entry(textvariable=numero,font=("Arial","12","bold"),bg="#3d85c6"
,fg="black",justify='center')
numero_entrada.place(relx=0.5,rely=0.2,relwidth=0.2)
#
bt_mostrar = Button( text="Mostrar", bd=2, bg='#107db2',
fg='white', font=('verdana', 14, 'bold'),
command=mostrar)
bt_mostrar.place(relx=0.2,rely=0.4, relwidth=0.3, relheight=0.1)
butlimpar = Button( text="Limpar", bd=2,
bg='#107db2', fg='white',
font=('verdana', 14, 'bold'),
command=limpar1)
butlimpar.place(relx=0.55, rely=0.4, relwidth=0.3, relheight=0.1)
resultado=Label( text="Horas",bg="#c1d5ee",
font=('verdana', 14, 'bold'))
resultado.place(relx=0.05,rely=0.55,relwidth=0.9)
vresultado = StringVar()
resultado=Label( textvariable=vresultado,bg="#c1d5ee",
font=('verdana', 14, 'bold'))
resultado.place(relx=0.05,rely=0.65,relwidth=0.9)
root.mainloop()
Comentários
Enviar um comentário