Bonjour à tous,

Je suis actuellement en train développer un programme de calcul du second degré, j'ai développé une grande partie du programme mais il me reste une petite partie et je ne vois absolument pas comment faire. Je connais le base de Python mais je débute dans ce qui est du reste. C'est un programme que je dois réaliser pour mon BAC ISN.

Nom : caputre second degré.PNG
Affichages : 776
Taille : 65,0 Ko

Voici à quoi ressemble visuellement ma page. A gauche les champs de saisie avec les boutons valider et entré et à droit ma frame qui affichera les résultats.
Le bouton validé fonctionne parfaitement et j'aimerais savoir comment faire pour lorsque j appuis sur nouveau et bien les champs d'entrée s'efface et efface les resultats de ma frame.

Voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
from tkinter import*
from math import*
 
fenetre3 = Tk()
fenetre3.title("Calcul second degré")
fenetre3.geometry("1080x680")
fenetre3.minsize(1080, 680)
fenetre3.maxsize(1080, 680)
fenetre3.config(background='#4065A4')
 
 
 
def calcul():
    try:
        AR1 = entrer1.get()
        AR = int(AR1)
 
        if AR > 0 and AR < 4:
            a1 = entrer2.get()
            a = float(a1)
            b1 = entrer3.get()
            b = float(b1)
            c1 = entrer4.get()
            c = float(c1)
 
            abc = a + b + c
 
            if abc < 1000:
                Δ1 = (b*b)-4*a*c
                Δ = int(Δ1)
                afficher.set("Δ = b² - 4 x a x c")
                afficher2.set('Δ ='+ str(Δ))
 
                if Δ>0:
                    X1 = (-b + sqrt(Δ))/2*a
                    X1A = round(X1,AR)
                    X2 = (-b - sqrt(Δ))/2*a
                    X2A = round(X2,AR)
 
                    afficher3.set("Δ > 0 donc il y a deux solutions.")
 
                    afficher4.set("Xa = (-b + √Δ ) / 2 x a")
                    afficher5.set('Xa = ('+str(-b) +' + √'+str(Δ) +') / 2 x '+str(a))
                    afficher6.set('Xa ='+ str(X1A))
 
                    afficher7.set("Xb = (-b - √Δ) / 2 x a")
                    afficher8.set('Xb = ('+str(-b) +' - √'+str(Δ) +') / 2 x '+str(a))
                    afficher9.set('Xb ='+ str(X2A))
 
                    if X1A>X2A:
                        afficher10.set('Donc les solutions sont ['+str(X2A)+';'+str(X1A)+']')
                    else:
                        afficher10.set('Donc les solutions sont ['+str(X1A)+';'+str(X2A)+']')
 
                elif Δ == 0 :
                    X = (-b)/(2*a)
                    XA = round(X,AR)
 
                    afficher3.set("Δ = 0 donc il y a deux solutions.")
 
                    afficher4.set("X = (-b) / (2 x a)")
                    afficher5.set('X = ('+str(-b) + ') / (2 x '+str(a)+')')
                    afficher6.set('X ='+ str(XA))
 
                    afficher7.set('Donc la solutions est '+str(XA))
 
                else:
                    afficher3.set("Δ < 0 donc il n'y a pas de solution.")
 
            else:
                for widget in frame.winfo_children():
                    widget.destroy()
 
                    lblresultat11=Label(frame,text=("Les nombres que vous utilisez sont beaucoup"), font=("Courier", 11),bg='white', fg='black').place(x='0', y='0')
                    lblresultat12=Label(frame, text=("trop grand !"), font=("Courier", 11),bg='white', fg='black').place(x='0', y='25')
                    lblresultat13=Label(frame, text=("Appuyer sur nouveau pour recommencer."), font=("Courier", 13, 'bold'),bg='white', fg='black').place(x='0', y='75')
 
        else:
            for widget in frame.winfo_children():
                widget.destroy()
 
                lblresultat11=Label(frame,text=("Le nombre de chiffre après la virgule doit"), font=("Courier", 11),bg='white', fg='black').place(x='0', y='0')
                lblresultat12=Label(frame, text=("être < 4 et > 0."), font=("Courier", 11),bg='white', fg='black').place(x='0', y='25')
                lblresultat16=Label(frame, text=("Appuyer sur nouveau pour recommencer."), font=("Courier", 13, 'bold'),bg='white', fg='black').place(x='0', y='75')
 
    except ValueError:
        for widget in frame.winfo_children():
            widget.destroy()
 
            lblresultat11=Label(frame,text=("Erreu, merci de taper un nombre !"), font=("Courier", 11),bg='white', fg='black').place(x='0', y='0')
            lblresultat12=Label(frame, text=("Appuyer sur nouveau pour recommencer."), font=("Courier", 13, 'bold'),bg='white', fg='black').place(x='0', y='50')
 
 
 
 
frame=Frame(fenetre3, bg='white', width=400, height=450,bd=7, relief=SUNKEN)
 
afficher = StringVar(frame)
lblresultat=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher).place(x='0', y='0')
 
afficher2 = StringVar(frame)
lblresultat2=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher2).place(x='0', y='25')
 
afficher3 = StringVar(frame)
lblresultat3=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher3).place(x='0', y='75')
 
afficher4 = StringVar(frame)
lblresultat4=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher4).place(x='0', y='100')
 
afficher5 = StringVar(frame)
lblresultat5=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher5).place(x='0', y='125')
 
afficher6 = StringVar(frame)
lblresultat6=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher6).place(x='0', y='150')
 
afficher7 = StringVar(frame)
lblresultat7=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher7).place(x='0', y='200')
 
afficher8 = StringVar(frame)
lblresultat8=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher8).place(x='0', y='225')
 
afficher9 = StringVar(frame)
lblresultat9=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher9).place(x='0', y='250')
 
afficher10 = StringVar(frame)
lblresultat10=Label(frame, font=("Courier", 11),bg='white', fg='black', textvariable=afficher10).place(x='0', y='300')
 
 
 
frame.pack(side=RIGHT, padx=25)
frame.pack_propagate(False)
 
 
 
 
 
 
 
label_title2 = Label(fenetre3, text="Saisir les nombres", font=("Cambria", 30), bg='#4065A4', fg='white').place(x='150', y='0')
 
entrer1 = StringVar(fenetre3)
label_title3 = Label(fenetre3, text="Nombre de chiffre après la virgule :", font=("Cambria", 15), bg='#4065A4', fg='white').place(x='50', y='120')
enter_label_title3=Entry(fenetre3, textvariable=(entrer1)).place(x='380',y='126')
 
entrer2 = StringVar(fenetre3)
label_title4 = Label(fenetre3, text="Donner la valeur de a :", font=("Cambria", 15), bg='#4065A4', fg='white').place(x='50', y='250')
enter_label_title4=Entry(fenetre3, textvariable=entrer2).place(x='380',y='256')
 
entrer3 = StringVar(fenetre3)
label_title5 = Label(fenetre3, text="Donner la valeur de b :", font=("Cambria", 15), bg='#4065A4', fg='white').place(x='50', y='300')
enter_label_title5=Entry(fenetre3, textvariable=entrer3).place(x='380',y='306')
 
entrer4 = StringVar(fenetre3)
label_title6 = Label(fenetre3, text="Donner la valeur de c :", font=("Cambria", 15), bg='#4065A4', fg='white').place(x='50', y='350')
enter_label_title6=Entry(fenetre3, textvariable=entrer4).place(x='380',y='356')
 
 
bouton_valider = Button(fenetre3, text="Valider", font=("Cambria", 30), bg='#4065A4', fg='white', width=20, command=calcul).place(x='100', y='480')
bouton_nouveau = Button(fenetre3, text="Nouveau", font=("Cambria", 30), bg='#4065A4', fg='white', width=20, command=nouveau).place(x='100', y='580')
bouton_copier = Button(fenetre3, text="Copier", font=("Cambria", 15), bg='#4065A4', fg='white', width=10).place(x='800', y='600')
 
 
 
 
 
fenetre3.mainloop()
Merci de votre réponse.