Bonjour,

Je suis en train de développer une interface graphique qui contient 4 tabs. Chaque tab contient un bouton qu'en cliquant affiche un graphe avec matplotlib. Le graphe peut afficher un plot ou plusieurs plots. Pour l'instant, je peux afficher plusieurs plots et je peux contrôler l'interface du graphe (fermer, zoomer, ...). Voici un extrait de 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
 
 
            fig = plt.figure(self.numFiguresPlot2_1) 
            fig.canvas.set_window_title(self.DropDownListDisplaySector2_1.currentText())
 
            x = np.arange(0, self.stockParam.nTotZones, 1)
            y = pd.to_numeric(matrix4["Price"])
            print("Moyenne = ")
            print(y.mean(0))
            z = pd.to_numeric(matrix4["Adjust"]*y)/100 + y
 
            # plot data
            if(firstPlot):
                price = plt.plot(x, y, label = ("Price"))
            shadowPrice = plt.plot(x, z, label = ("Price + adjust for iteration "+self.DropDownListDisplayIter2_1.currentText()))
 
 
            plt.ion()
            plt.legend() 
            draw_thread = threading.Thread(target=plt.show)  
            draw_thread.start()
 
            plt.ioff()
Mon problème est que quand je ferme la première fenêtre du graphe et quand j'essaie d'afficher une deuxième fenêtre du graphe, une fenêtre vide tkinter s'affiche. Je ne comprends pas ce problème.

Des pistes svp ?

Merc.