Jan-09-2020, 04:47 PM
from tkinter import * Appli = Tk() Appli.title("Application de retraite") Appli.geometry("640x640") label1 = Label(Appli,text="Entrez votre nom: ",font=("arial",12,"bold"),bg="#2340B6", fg="white") label1.place(x=20, y=100) i= StringVar() entry_box1= Entry(Appli, textvariable=i, bg="white", width="15") entry_box1.place(x=190,y=105) label2= Label(Appli,text="Quelle est votre année de naissance? : ",font=("arial",12,"bold"),bg="#2340B6", fg="white") label2.place(x=20, y=175) k= IntVar() entry_box2= Entry(Appli, textvariable=k, bg="white", width="15") entry_box2.place(x=340,y=180) label3= Label(Appli,text="Quel est votre revenu mensuel sur vos six derniers mois? : ",font=("arial",12,"bold"),bg="#2340B6", fg="white") label3.place(x=20, y=255) revenu_moyen= IntVar() entry_box3= Entry(Appli, textvariable=revenu_moyen, bg="white", width="15") entry_box3.place(x=500,y=260) label4= Label(Appli,text="Combien de trimestres avez vous cotisé? : ",font=("arial",12,"bold"),bg="#2340B6", fg="white") label4.place(x=20, y=335) trimestre_cotisés= IntVar() entry_box4= Entry(Appli, textvariable=trimestre_cotisés, bg="white", width="15") entry_box4.place(x=380,y=340) label5= Label(Appli,text="Combien avez vous d'enfants? : ",font=("arial",12,"bold"),bg="#2340B6", fg="white") label5.place(x=20, y=410) enfants=IntVar() entry_box5 = Entry(Appli, textvariable=enfants, bg="white", width="10") entry_box5.place(x=300,y=415) def verific(): if not i.get() or i.get().isnumeric() == True: button.configure(state = DISABLED) Appli.after(1, verific) else: button.configure(state = NORMAL) Appli.after(1, verific) def do_it(): print("execute your function here") button= Button(Appli, text="Calculer", width="20", height="3",command=do_it,font=("arial",12,"bold"),bg="white",fg="#2340B6") button.place(x=20, y=500) verific() Appli.mainloop()
entry_box1 is verified by this example.