Bonjour,
Lorsque je lance ce programme cela me permet de faire mon choix mais il ne fait apparaitre les courbes qu'apres avoir fermer la fenetre principale alors que je souhaiterais les afficher apres la fermeture de la fenêtre choice
Tout fonctionne le probleme et que la courbe s'affiche quand je ferme toute les fenetre tkinter.
Comment faire ?
Merci pour votre aide

Voici le programme :
"""
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
 
 
def choix():
    choix = tki.Toplevel()  
    x = tki.StringVar()  
    z = tki.StringVar()  
    xz = tki.StringVar()
    Title = tki.Label(choix, text="Selon quels axes voulez vous les courbes ? ")
    Title.pack()
    chkbtn1 = tki.Checkbutton(choix, text = "X", variable = x, onvalue=1, offvalue=0)
    chkbtn1.deselect()
    chkbtn1.pack()
    chkbtn2 = tki.Checkbutton(choix, text = "Z", variable = z, onvalue=1, offvalue=0)
    chkbtn2.deselect()
    chkbtn2.pack()
    chkbtn3 = tki.Checkbutton(choix, text = "X et Z", variable = xz, onvalue=1, offvalue=0)  
    chkbtn3.deselect()
    chkbtn3.pack()
    bouton_entree = tki.Button(choix, text="Entrée", command = choix.destroy )
    bouton_entree.pack()
    choix.mainloop()
    X=int(x.get())
    Z=int(z.get())
    XZ=int(xz.get())
    return X,Z,XZ
 
def prtphase(Lx, Lz, t, X, Z, XZ):
    tv = []
    vX, vZ = deriv(Lx, t), deriv(Lz, t)
    aX, aZ = deriv(vX, t), deriv(vZ, t)
    xadapt, zadapt, vxadapt, vzadapt = [], [], [], []
 
    for i in range(1,len(t)-1):
        tv.append(t[i])
    for i in range (1,len(Lx)-1):
        xadapt.append(Lx[i])
        zadapt.append(Lz[i])
    for i in range (1,len(vX)-1):
        vxadapt.append(vX[i])
        vzadapt.append(vZ[i])
 
    if XZ==1 or (X==1 and Z==1):
        plt.subplot(221)
        plt.title('Portrait de phase x')
        plt.plot(xadapt, vX)
        plt.grid()
        plt.subplot(222)
        plt.title('Portrait de phase vx')
        plt.plot(vxadapt, aX)
        plt.grid()
        plt.subplot(223)
        plt.title('Portrait de phase z')
        plt.plot(zadapt, vZ)
        plt.grid()
        plt.subplot(224)
        plt.title('Portrait de phase vz')
        plt.plot(vzadapt, aZ)
        plt.grid()
        plt.show()
 
    elif X==1:
        plt.subplot(211)
        plt.title('Portrait de phase x')
        plt.plot(xadapt, vX)
        plt.grid()
        plt.subplot(212)
        plt.title('Portrait de phase vx')
        plt.plot(vxadapt, aX)
        plt.grid()
        plt.show()
 
    elif Z==1:
        plt.subplot(211)
        plt.title('Portrait de phase z')
        plt.plot(zadapt, vZ)
        plt.grid()
        plt.subplot(212)
        plt.title('Portrait de phase vz')
        plt.plot(vzadapt, aZ)
        plt.grid()
        plt.show()
 
def bprt():
    X, Z, XZ = choix()
    prtphase(Lx, Lz, t, X, Z, XZ)
 
interface = tki.Tk()
...
bouton_prt = tki.Button(interface, text="Portrait de phase", command = bprt )
bouton_prt.pack()
...
interface.mainloop()
"""