Hi,

if you don't want to create your own class a quick and dirty way is to 
"monkey patch" the addItem() method and insert your own code there.
Something along the lines:

oldAddItem = the_viewbox.addItem

def myAddFunc(*args, **kwargs):
    # do something before the item is added
    oldAddItem(*args, **kwargs)
    # do something after the item is added
    # or yourSignal.emit()

the_viewbox.addItem = myAddFunc

I haven't tested the code, so this might need tweaking.


Cheers,
Sebastian



Am Mittwoch, 29. November 2017 09:16:23 UTC+1 schrieb Carlos Pascual:
>
> Hi, 
>
> I've been looking for a way of getting a signal when a new item is added 
> to a PlotWidget or ViewBox
>
> Ideally something in the style of "ViewBox.sigItemAdded"
>
> I understand that I could derive ViewBox and/or PlotWidget and reimplement 
> the addItem() method to emit such a signal, but this is really something I 
> would like to avoid because I would need my code to work with the 
> "unmodified" PyQtgraph objects.
>
> So I am wondering if this is already possible in some other way (or if it 
> would be a wanted feature, in which case I would be happy to submit a Pull 
> Request with an implementation)
>

-- 
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/63956eac-6cc1-407c-b27d-29640f6cbe8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to