Bonjour,

J'ai une interface graphique qui contient un bouton "generate graph". En cliquant sur ce bouton, j'ai la possibilité de générer des graphes sur la même figure ou plusieurs graphes. Mon problème est que en lançant ces figures (l'interface graphique principale est toujours ouverte), je ne peux pas les contrôler : je ne peux pas les fermer ni enregistrer les figures. Cependant, quand je ferme l'interface graphique principale, je peux avoir le contrôle sur les figures :fermer, enregistrer, zommer, etc ....

Je ne comprends pas ce problème.

Je vous mets un extrait de mon code de la génération du graphe :
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
 
#This boolean is used to allow for multiple graphes to be shown on the same panel.
            firstPlot = False
 
 
            #Plot graph and display it
 
 
 
            if(self.DropDownListDisplaySector2_1.currentIndex() != self.currentSectorPlot2_1):
                self.numFiguresPlot2_1 = self.numFiguresPlot2_1 + 1
                self.currentSectorPlot2_1 = self.DropDownListDisplaySector2_1.currentIndex()
                firstPlot = True
 
 
            fig = plt.figure(self.numFiguresPlot2_1)
 
 
            fig.canvas.set_window_title(self.DropDownListDisplaySector2_1.currentText())
            plt.hold(True)
 
            x = np.arange(0, self.stockParam.nTotZones, 1);
            #y = matrix4["Price"].convert_objects(convert_numeric=True)
            y = pd.to_numeric(matrix4["Price"])
            print("Moyenne = ")
            print(y.mean(0))
            #z = (matrix4["Adjust"].convert_objects(convert_numeric=True)*y)/100 + y
            z = pd.to_numeric(matrix4["Adjust"]*y)/100 + y
 
            if(firstPlot):
                price = plt.plot(x, y, label = ("Price"))
            shadowPrice = plt.plot(x, z, label = ("Price + adjust for iteration "+self.DropDownListDisplayIter2_1.currentText()))
 
            plt.legend()
 
 
            plt.show(block=False) #method 3
            plt.draw()