from tkinter import *
root = Tk()
root.geometry("400x300")
root.resizable(0,0)
root.title("Verificar se é Primo")
root.configure(bg="#c1d5ee")
def limpar1():
numero_entrada.delete(0, END)
def butaoclick1():
a = numero.get()
for i in range(2, a):
if a == 2 or a == 3 or a == 1:
mgs=f'{a} é um número primo!'
resultadof["fg"] = 'green'
break
elif (a% i == 0):
mgs=f'{a} não é um número primo.'
resultadof["fg"] = 'green'
break
else:
mgs=f'{a} é um número primo!'
resultadof["fg"] = 'blue'
break
resultado.set(mgs)
texto_entrada= Label(text="Insere o número",justify='center',
font=('verdana', 14, 'bold'),bg="#c1d5ee")
texto_entrada.place(relx=0.3,rely=0.1)
numero = IntVar()
numero_entrada= Entry( textvariable=numero,justify='center')
numero_entrada.place(relx=0.35,rely=0.25)
bt_calcular1 = Button( text="Verificar", bd=2, bg='#107db2',
fg='white', font=('verdana', 14, 'bold'),
command=butaoclick1)
bt_calcular1.place(relx=0.2,rely=0.5, relwidth=0.3, relheight=0.1)
butlimpar1 = Button( text="Limpar", bd=2,
bg='#107db2', fg='white',
font=('verdana', 14, 'bold'),command=limpar1)
butlimpar1.place(relx=0.55, rely=0.5, relwidth=0.3, relheight=0.1)
resultado = StringVar()
resultadof =Label(textvariable=resultado,justify='center',bg="#c1d5ee",
font=('verdana', 14, 'bold'))
resultadof.place(relx=0.15,rely=0.75,relwidth=0.8)
root.mainloop()