Dear Forum
In my GUI, I have a grid 1 row, 2 col ,so used:
-In col 0, some button
-In col 1, a object PlotWidget()
The PlotWidget() work very good, so , no preblem in set all the option
was mentioned in the book . Also updating it with random data in a timer was realy easy and nice to see.
The plot was placed in col 1,in this way:
self.Grid.addWidget(self.Obj_Plot_A,0,1)
Problem start when i want to visualize another plot in the same position:
self.Grid.addWidget(self.Obj_Plot_B,0,1)
where Obj_Plot_B have difefrent label, color ecc…
What happend is this:
1)I start with Obj_Plot_A ,and, all ok
2)When press a button, i replace with Obj_Plot_B, and all ok
3)replacing again with Obj_Plot_A is not working; the Obj_Plot_B
will remain visible, and A not.
I noted that, Obj_Plot_A is alwais there when replacing with _B,but, seems it moves in other position…
I also try with the removeWidget(), but not work:
self…Grid.removeWidget(self…Obj_Plot_B)
self.Grid.addWidget(self.Obj_Plot_A,0,1)
But worst again, if i try this:
self.Grid.removeWidget(self.Obj_Plot_A)
self.Grid.removeWidget(self.Obj_Plot_B)
they stay…??
—I also try this solution:
Try to avoid to mess with grid, try this solution :
self.widplot=QMainWindow()
self.widplot.setCentralWidget(self.Obj_Plot_At)
self.Grid_1x2.addWidget(self.widplot,0,1)
In this way, i add the widplot to the grid, and dont change any more.
What i chenge will be, depending of what plot i want to visualize:
self.widplot.setCentralWidget(self.Obj_Plot_A)
or
self.widplot.setCentralWidget(self.Obj_Plot_B)
In this case ,I can see the see the Obj_Plot_A OK, then, change to _B
but imidiatly afer, a lot of this error:
self.updateItems( styleUpdate = self.property(‘styleWasChanged’) )
RuntimeError: Internal C++ object (PlotDataItem) already deleted.
Excuse for long message, and thanks for help
Roberto