from tkinter import *
root = Tk()
def butaofuncao():
N = int(entrada_numero.get())
j = 0
for i in range(0, N):
if (i ** 2 == N):
j = i
break
if j > 0:
texto['text'] = str(N) + " é uma raiz quadrada perfeita" + str(N) + " = " + str(j) + " ^ 2"
else:
texto['text'] = str(N) + " não é uma raiz quadrada perceita ! "
root.title('Python Tkinter')
root.geometry("400x170")
root.resizable(False,False)
l_numero = Label( text= "Digite o número inteiro: ")
l_numero.place(relx =0.1 , rely =0.05)
entrada_numero = Entry(justify='center')
entrada_numero.place(relx = 0.45, rely = 0.05 , relwidth = 0.2)
texto = Label(text='...........')
texto.place(relx =0.35 , rely =0.55)
#
butao = Button(root, text="Validar",command=butaofuncao)
butao.place(relx =0.4, rely =0.3,relwidth = 0.25)
root.mainloop()
Comentários
Enviar um comentário