@@ -1708,7 +1708,6 @@ def __init__(self, figure=None):
1708
1708
self .widgetlock = widgets .LockDraw ()
1709
1709
self ._button = None # the button pressed
1710
1710
self ._key = None # the key pressed
1711
- self ._lastx , self ._lasty = None , None
1712
1711
self .mouse_grabber = None # the Axes currently grabbing mouse
1713
1712
self .toolbar = None # NavigationToolbar2 will set me
1714
1713
self ._is_idle_drawing = False
@@ -1779,241 +1778,9 @@ def is_saving(self):
1779
1778
"""
1780
1779
return self ._is_saving
1781
1780
1782
- @_api .deprecated ("3.6" , alternative = "canvas.figure.pick" )
1783
- def pick (self , mouseevent ):
1784
- if not self .widgetlock .locked ():
1785
- self .figure .pick (mouseevent )
1786
-
1787
1781
def blit (self , bbox = None ):
1788
1782
"""Blit the canvas in bbox (default entire canvas)."""
1789
1783
1790
- def resize (self , w , h ):
1791
- """
1792
- UNUSED: Set the canvas size in pixels.
1793
-
1794
- Certain backends may implement a similar method internally, but this is
1795
- not a requirement of, nor is it used by, Matplotlib itself.
1796
- """
1797
- # The entire method is actually deprecated, but we allow pass-through
1798
- # to a parent class to support e.g. QWidget.resize.
1799
- if hasattr (super (), "resize" ):
1800
- return super ().resize (w , h )
1801
- else :
1802
- _api .warn_deprecated ("3.6" , name = "resize" , obj_type = "method" ,
1803
- alternative = "FigureManagerBase.resize" )
1804
-
1805
- @_api .deprecated ("3.6" , alternative = (
1806
- "callbacks.process('draw_event', DrawEvent(...))" ))
1807
- def draw_event (self , renderer ):
1808
- """Pass a `DrawEvent` to all functions connected to ``draw_event``."""
1809
- s = 'draw_event'
1810
- event = DrawEvent (s , self , renderer )
1811
- self .callbacks .process (s , event )
1812
-
1813
- @_api .deprecated ("3.6" , alternative = (
1814
- "callbacks.process('resize_event', ResizeEvent(...))" ))
1815
- def resize_event (self ):
1816
- """
1817
- Pass a `ResizeEvent` to all functions connected to ``resize_event``.
1818
- """
1819
- s = 'resize_event'
1820
- event = ResizeEvent (s , self )
1821
- self .callbacks .process (s , event )
1822
- self .draw_idle ()
1823
-
1824
- @_api .deprecated ("3.6" , alternative = (
1825
- "callbacks.process('close_event', CloseEvent(...))" ))
1826
- def close_event (self , guiEvent = None ):
1827
- """
1828
- Pass a `CloseEvent` to all functions connected to ``close_event``.
1829
- """
1830
- s = 'close_event'
1831
- try :
1832
- event = CloseEvent (s , self , guiEvent = guiEvent )
1833
- self .callbacks .process (s , event )
1834
- except (TypeError , AttributeError ):
1835
- pass
1836
- # Suppress the TypeError when the python session is being killed.
1837
- # It may be that a better solution would be a mechanism to
1838
- # disconnect all callbacks upon shutdown.
1839
- # AttributeError occurs on OSX with qt4agg upon exiting
1840
- # with an open window; 'callbacks' attribute no longer exists.
1841
-
1842
- @_api .deprecated ("3.6" , alternative = (
1843
- "callbacks.process('key_press_event', KeyEvent(...))" ))
1844
- def key_press_event (self , key , guiEvent = None ):
1845
- """
1846
- Pass a `KeyEvent` to all functions connected to ``key_press_event``.
1847
- """
1848
- self ._key = key
1849
- s = 'key_press_event'
1850
- event = KeyEvent (
1851
- s , self , key , self ._lastx , self ._lasty , guiEvent = guiEvent )
1852
- self .callbacks .process (s , event )
1853
-
1854
- @_api .deprecated ("3.6" , alternative = (
1855
- "callbacks.process('key_release_event', KeyEvent(...))" ))
1856
- def key_release_event (self , key , guiEvent = None ):
1857
- """
1858
- Pass a `KeyEvent` to all functions connected to ``key_release_event``.
1859
- """
1860
- s = 'key_release_event'
1861
- event = KeyEvent (
1862
- s , self , key , self ._lastx , self ._lasty , guiEvent = guiEvent )
1863
- self .callbacks .process (s , event )
1864
- self ._key = None
1865
-
1866
- @_api .deprecated ("3.6" , alternative = (
1867
- "callbacks.process('pick_event', PickEvent(...))" ))
1868
- def pick_event (self , mouseevent , artist , ** kwargs ):
1869
- """
1870
- Callback processing for pick events.
1871
-
1872
- This method will be called by artists who are picked and will
1873
- fire off `PickEvent` callbacks registered listeners.
1874
-
1875
- Note that artists are not pickable by default (see
1876
- `.Artist.set_picker`).
1877
- """
1878
- s = 'pick_event'
1879
- event = PickEvent (s , self , mouseevent , artist ,
1880
- guiEvent = mouseevent .guiEvent ,
1881
- ** kwargs )
1882
- self .callbacks .process (s , event )
1883
-
1884
- @_api .deprecated ("3.6" , alternative = (
1885
- "callbacks.process('scroll_event', MouseEvent(...))" ))
1886
- def scroll_event (self , x , y , step , guiEvent = None ):
1887
- """
1888
- Callback processing for scroll events.
1889
-
1890
- Backend derived classes should call this function on any
1891
- scroll wheel event. (*x*, *y*) are the canvas coords ((0, 0) is lower
1892
- left). button and key are as defined in `MouseEvent`.
1893
-
1894
- This method will call all functions connected to the 'scroll_event'
1895
- with a `MouseEvent` instance.
1896
- """
1897
- if step >= 0 :
1898
- self ._button = 'up'
1899
- else :
1900
- self ._button = 'down'
1901
- s = 'scroll_event'
1902
- mouseevent = MouseEvent (s , self , x , y , self ._button , self ._key ,
1903
- step = step , guiEvent = guiEvent )
1904
- self .callbacks .process (s , mouseevent )
1905
-
1906
- @_api .deprecated ("3.6" , alternative = (
1907
- "callbacks.process('button_press_event', MouseEvent(...))" ))
1908
- def button_press_event (self , x , y , button , dblclick = False , guiEvent = None ):
1909
- """
1910
- Callback processing for mouse button press events.
1911
-
1912
- Backend derived classes should call this function on any mouse
1913
- button press. (*x*, *y*) are the canvas coords ((0, 0) is lower left).
1914
- button and key are as defined in `MouseEvent`.
1915
-
1916
- This method will call all functions connected to the
1917
- 'button_press_event' with a `MouseEvent` instance.
1918
- """
1919
- self ._button = button
1920
- s = 'button_press_event'
1921
- mouseevent = MouseEvent (s , self , x , y , button , self ._key ,
1922
- dblclick = dblclick , guiEvent = guiEvent )
1923
- self .callbacks .process (s , mouseevent )
1924
-
1925
- @_api .deprecated ("3.6" , alternative = (
1926
- "callbacks.process('button_release_event', MouseEvent(...))" ))
1927
- def button_release_event (self , x , y , button , guiEvent = None ):
1928
- """
1929
- Callback processing for mouse button release events.
1930
-
1931
- Backend derived classes should call this function on any mouse
1932
- button release.
1933
-
1934
- This method will call all functions connected to the
1935
- 'button_release_event' with a `MouseEvent` instance.
1936
-
1937
- Parameters
1938
- ----------
1939
- x : float
1940
- The canvas coordinates where 0=left.
1941
- y : float
1942
- The canvas coordinates where 0=bottom.
1943
- guiEvent
1944
- The native UI event that generated the Matplotlib event.
1945
- """
1946
- s = 'button_release_event'
1947
- event = MouseEvent (s , self , x , y , button , self ._key , guiEvent = guiEvent )
1948
- self .callbacks .process (s , event )
1949
- self ._button = None
1950
-
1951
- # Also remove _lastx, _lasty when this goes away.
1952
- @_api .deprecated ("3.6" , alternative = (
1953
- "callbacks.process('motion_notify_event', MouseEvent(...))" ))
1954
- def motion_notify_event (self , x , y , guiEvent = None ):
1955
- """
1956
- Callback processing for mouse movement events.
1957
-
1958
- Backend derived classes should call this function on any
1959
- motion-notify-event.
1960
-
1961
- This method will call all functions connected to the
1962
- 'motion_notify_event' with a `MouseEvent` instance.
1963
-
1964
- Parameters
1965
- ----------
1966
- x : float
1967
- The canvas coordinates where 0=left.
1968
- y : float
1969
- The canvas coordinates where 0=bottom.
1970
- guiEvent
1971
- The native UI event that generated the Matplotlib event.
1972
- """
1973
- self ._lastx , self ._lasty = x , y
1974
- s = 'motion_notify_event'
1975
- event = MouseEvent (s , self , x , y , self ._button , self ._key ,
1976
- guiEvent = guiEvent )
1977
- self .callbacks .process (s , event )
1978
-
1979
- @_api .deprecated ("3.6" , alternative = (
1980
- "callbacks.process('leave_notify_event', LocationEvent(...))" ))
1981
- def leave_notify_event (self , guiEvent = None ):
1982
- """
1983
- Callback processing for the mouse cursor leaving the canvas.
1984
-
1985
- Backend derived classes should call this function when leaving
1986
- canvas.
1987
-
1988
- Parameters
1989
- ----------
1990
- guiEvent
1991
- The native UI event that generated the Matplotlib event.
1992
- """
1993
- self .callbacks .process ('figure_leave_event' , LocationEvent ._lastevent )
1994
- LocationEvent ._lastevent = None
1995
- self ._lastx , self ._lasty = None , None
1996
-
1997
- @_api .deprecated ("3.6" , alternative = (
1998
- "callbacks.process('enter_notify_event', LocationEvent(...))" ))
1999
- def enter_notify_event (self , guiEvent = None , * , xy ):
2000
- """
2001
- Callback processing for the mouse cursor entering the canvas.
2002
-
2003
- Backend derived classes should call this function when entering
2004
- canvas.
2005
-
2006
- Parameters
2007
- ----------
2008
- gu
10000
iEvent
2009
- The native UI event that generated the Matplotlib event.
2010
- xy : (float, float)
2011
- The coordinate location of the pointer when the canvas is entered.
2012
- """
2013
- self ._lastx , self ._lasty = x , y = xy
2014
- event = LocationEvent ('figure_enter_event' , self , x , y , guiEvent )
2015
- self .callbacks .process ('figure_enter_event' , event )
2016
-
2017
1784
def inaxes (self , xy ):
2018
1785
"""
2019
1786
Return the topmost visible `~.axes.Axes` containing the point *xy*.