ipympl icon indicating copy to clipboard operation
ipympl copied to clipboard

Support for trait _view_count

Open bdch1234 opened this issue 2 years ago • 5 comments

The trait _view_count does not seem to populate on the canvas (always None). Is it not supported for ipympl?

bdch1234 avatar Aug 09 '22 14:08 bdch1234

Interesting. I didn't know that the existed. I don't see a strong reason not to support it. Though it may be hard to keep track of when a view is no longer displayed?

@martinRenou do you have any thoughts on this?

I'd say my current position is that I would be happy to review a PR implementing this so that we can decide if there are any tradeoffs - but suspect that there's no harm in implementing this.

ianhi avatar Aug 09 '22 17:08 ianhi

oh wait, is all we have to set it equal to 0?

ianhi avatar Aug 09 '22 17:08 ianhi

Thanks for opening an issue. I don't think this is specific to ipympl, it seems it has been added in ipywidgets in https://github.com/jupyter-widgets/ipywidgets/pull/1232.

oh wait, is all we have to set it equal to 0?

Probably, there is a check for it to be a number here.

I'd personally say that users of ipympl shouldn't need to access this property (after all it starts with an underscore).

But I actually didn't know this was a thing. We can probably use this to cleanup figures on the backend. What do you think @ianhi ?

martinRenou avatar Aug 10 '22 07:08 martinRenou

But I actually didn't know this was a thing. We can probably use this to cleanup figures on the backend. What do you think @ianhi ?

That’s exactly the use-case I was going for here, but it that would be possible to do directly in ipympl then it would be even better of course

bdch1234 avatar Aug 10 '22 07:08 bdch1234

Unfortunately such a logic would break if there are multiple clients.

martinRenou avatar Aug 10 '22 08:08 martinRenou