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/764c3410-5b7c-49ef-aa7d-c6071c9c417e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to