change context menu for histogram item inside imageview

107 views
Skip to first unread message

azpa...@gmail.com

unread,
Jun 14, 2021, 12:02:45 PM6/14/21
to pyqtgraph
Hello,
I am trying to change the context menu available when we right click on the histogram of an image view but I cannot find anywhere any reference to it. Where is created? How can I change it? 

I saw for the image itself there is a buildMenu() option which actually creates that context menu and saves it in self.menu. Is there an equivalent for the histogram somewhere? 

Kind regards,
Lavinia

azpa...@gmail.com

unread,
Jun 15, 2021, 7:20:02 AM6/15/21
to pyqtgraph
to answer my own question:
 imv = pg.ImageView()
 histo_item = imv.getHistogramWidget().vb.menu.addAction("Extra action")

I expected that: imv.getHistogramWidget().item.getViewBox() would be returning the viewbox but it gives the LUTHistogramWidget... Tbh this was not intuitive to me, so if someone can explain why I would appreciate it. 
Kind regards,
Lavinia

Reply all
Reply to author
Forward
0 new messages