ok I managed to figure it out and posting here if some else has the same 
question

I changed the plotting to imageItem

Enter code here...vb = pg.ViewBox()
        self.ui.PMTVoltage_plt.useOpenGL()
        self.ui.PMTVoltage_plt.setCentralItem(vb)
        self.img = pg.ImageItem(pmtImage)
        vb.addItem(self.img)

and then got the vb back in other function using

Enter code here...vb = self.ui.PMTVoltage_plt.getViewBox()
        items = vb.mapSceneToView(event.scenePos())
        pixels = vb.mapFromViewToItem(self.img, items)






On Wednesday, September 13, 2017 at 5:02:40 PM UTC-7, Pramod Butte wrote:
>
> Just add I went through the entire ui variable in debug to look for vb or 
> image Item and could not find it.
>
> infact the only thing I found was,
>
> items = {dict} {<pyqtgraph.graphicsItems.ViewBox.ViewBox.ViewBox object at 
> 0x000001CF73888CA8>: [(0, 0)]}
>  <pyqtgraph.graphicsItems.ViewBox.ViewBox.ViewBox object at 
> 0x000001CF73888CA8> (1990508186792) = {list} <class 'list'>: [(0, 0)]
>   0 = {tuple} <class 'tuple'>: (0, 0)
>    0 = {int} 0
>    1 = {int} 0
>    __len__ = {int} 2
>   __len__ = {int} 1
>  __len__ = {int} 1
>
>
> On Wednesday, September 13, 2017 at 4:38:40 PM UTC-7, Pramod Butte wrote:
>>
>>
>> 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/84a0de34-8a39-4132-a816-6db2bdb02445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to