Add export option to custom right click menu on custom view box

83 views
Skip to first unread message

Joel Adamson

unread,
Jul 9, 2017, 9:12:11 PM7/9/17
to pyqtgraph
Hey,

I wanted to add the option to export to a custom viewbox context menu. So far I've tried:

for item in pg.plot().scene().contextMenu:
     
self.menu.addAction(item)

because the returned value is a QAction item.

This just crashes the kernel.

Help?


Joel Adamson

unread,
Jul 9, 2017, 9:13:39 PM7/9/17
to pyqtgraph

Joel Adamson

unread,
Jul 9, 2017, 9:40:53 PM7/9/17
to pyqtgraph
*************Edit******************

I figured it out, mostly:
def raiseContextMenu(self, ev):
       
"""
        Raise the context menu
        """

       
if not self.menuEnabled():
           
return
        menu
= self.getMenu()

        menu
= self.scene().addParentContextMenus(self, menu, ev)

        pos  
= ev.screenPos()
        menu
.popup(QtCore.QPoint(pos.x(), pos.y()))




On Sunday, 9 July 2017 18:12:11 UTC-7, Joel Adamson wrote:
Reply all
Reply to author
Forward
0 new messages