<div dir="ltr"><div dir="ltr">Fedric,<div><br></div><div>Hello from NSLS-II!</div><div><br></div><div>`_veiws` is private so we reserve the right to change it at any time.   `.views()` was a Stack of lists of the xlim and ylim of all of the Axes in the Figure.  I suggest replacing it with something like</div><div><br></div><div><div>class HiddenToolbar(NavigationToolbar2QT):</div><div>    def __init__(self, corner_callback, canvas):</div><div>        super(HiddenToolbar, self).__init__(canvas, None)</div><div>        self._corner_callback = corner_callback</div><div>        self.zoom()</div><div>        </div><div>    def _generate_key(self):</div><div>        limits = []</div><div>        for a in self.canvas.figure.get_axes():</div><div>            limits.append([a.get_xlim(), a.get_ylim()])       </div><div>        return limits</div><div><br></div><div>    def press(self, event):</div><div>        self._corner_preclick = self._generate_key()</div><div><br></div><div>    def release(self, event):</div><div>        if self._corner_preclick == self._generate_key():</div><div>            self._corner_callback(event.xdata, event.ydata)</div><div>        self._corner_preclick = None</div><div><br></div></div><div><br></div><div>which only uses public APIs from upstream.</div><div><br></div><div>What is the purpose of this code?  It looks like this is a de-bouncer to cancel a callback if something changes the limits while the mouse is held down?</div><div><br></div><div>Tom</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 15, 2019 at 3:52 AM PICCA Frederic-Emmanuel <<a href="mailto:frederic-emmanuel.picca@synchrotron-soleil.fr">frederic-emmanuel.picca@synchrotron-soleil.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I have this code in one of  the project I neded to update.<br>
Since we are targetting Debian buster, I need to support<br>
matplotlib 2.X (python2) AND matplotlib 3.X  (python3)<br>
<br>
<br>
class HiddenToolbar(NavigationToolbar2QT):<br>
    def __init__(self, corner_callback, canvas):<br>
        super(HiddenToolbar, self).__init__(canvas, None)<br>
        self._corner_callback = corner_callback<br>
        self.zoom()<br>
<br>
    def press(self, event):<br>
        self._corner_preclick = self._views()<br>
<br>
    def release(self, event):<br>
        if self._corner_preclick == self._views():<br>
            self._corner_callback(event.xdata, event.ydata)<br>
        self._corner_preclick = None<br>
<br>
<br>
<br>
The problem, I have is with the  _views() method.<br>
The 3.X version, complains that it is not available in the NavigationToolbar2QT.<br>
<br>
so I would like to know how to rewrite this in order to be 2.X and 3.X compatible.<br>
I tryed to find some information in the documentation about this but I did not find it.<br>
<br>
thanks for your help.<br>
<br>
Frederic<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Thomas Caswell<br><a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a></div>