I am new to PyqtGraph ( Infact this is my first time)

I have a Qt designer file which I import in my python code. I 6 windows in 
which I plot a 42x22 (different sizes) as an inmage, these have been 
promoted the graphicview. 

I have a data set which is 6x42x22 and so I use a for loop to plot the 6 
images


 for n in range(imageStackSize):
            self.glayout = pg.GraphicsLayout()
            self.vb = self.glayout.addViewBox()
            self.vb.setAspectLocked(lock=True, ratio=self.aspect_ratio)
            img_temp = image[n, :, :]


            img = pg.ImageItem(img_temp,  lut=self.jet_lut)
            if n == 0:
                self.ui.Channel1_img.setCentralItem(self.glayout)
                self.vb.addItem(img)

            elif n == 1:
                self.ui.Channel2_img.setCentralItem(self.glayout)
                self.vb.addItem(img)

            elif n == 2:
                self.ui.Channel3_img.setCentralItem(self.glayout)
                self.vb.addItem(img)
            elif n == 3:
                self.ui.Channel4_img.setCentralItem(self.glayout)
                self.vb.addItem(img)
            elif n == 4:
                self.ui.Channel5_img.setCentralItem(self.glayout)
                self.vb.addItem(img)
            elif n == 5:
                self.ui.Channel6_img.setCentralItem(self.glayout)
                self.vb.addItem(img)


After this I am trying to click on one of the image (ideally I would like 
to make it such that I can click any of the six images) to get the (6,x,y) 
coordinated the first dimension does not matter. In order to achieve this I 
did

        self.ui.Channel1_img.scene().sigMouseClicked.connect(self.onClick)
        #self.ui.Channel2_img.scene().sigMouseClicked.connect(self.onClick)
        #self.ui.Channel3_img.scene().sigMouseClicked.connect(self.onClick)
        #self.ui.Channel4_img.scene().sigMouseClicked.connect(self.onClick)
        #self.ui.Channel5_img.scene().sigMouseClicked.connect(self.onClick)
        #self.ui.Channel6_img.scene().sigMouseClicked.connect(self.onClick)
        
#self.ui.PMTVoltage_plt.scene().sigMouseClicked.connect(self.onClick)

 def onClick(self, event):
        print("clicked")
        
and then I tried 
        items = 
self.ui.Channel1_img.imageItem.mapFromViewToItem(event.pos())
and
        items = 
self.ui.Channel1_img.imageItem.mapFromSceneToView(event.pos())
 
 but the prog just crashes. I read somewhere that the coordinates are in 
the viewbox, but I cant seem to find the viewbox or vb in the 
self.ui.Channel1_img

what am I missing? Any help is appreciated

thanks,
Pramod

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/4360bd25-6b38-4046-8604-68d851c71f8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to