I'm building a program where a user can interact with a pyqtgraph
ImageView
(e.g. place markers, change brightness and contrast). I want to be able to cycle through different images, but have each image remember its state with the markers etc. I feel like the most appropriate solution would be to create a copy of the ImageView
for each image and show the current one and hide the other ones. What would be the best way to do that and would that even be a good idea?
My naive approach was placing an empty widget in Qt Designer (called graphWidget
), promoting that to the ImageView
class, and then in the program:
graphWidget_backup = self.graphWidget
secondWidget = pg.ImageView()
secondWidget.setImage(np.random.rand(256,256))
self.graphWidget = secondWidget
But with that, nothing happens.
Of course I could also just save the image data and all other changes manually and set them on the ImageView
, but that feels less elegant and "object oriented".