MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / _release

Method _release

site-packages/matplotlib/widgets.py:2147–2197  ·  view source on GitHub ↗

on button release event

(self, event)

Source from the content-addressed store, hash-verified

2145 self.set_visible(self.visible)
2146
2147 def _release(self, event):
2148 """on button release event"""
2149 if not self.interactive:
2150 self.to_draw.set_visible(False)
2151
2152 # update the eventpress and eventrelease with the resulting extents
2153 x1, x2, y1, y2 = self.extents
2154 self.eventpress.xdata = x1
2155 self.eventpress.ydata = y1
2156 xy1 = self.ax.transData.transform_point([x1, y1])
2157 self.eventpress.x, self.eventpress.y = xy1
2158
2159 self.eventrelease.xdata = x2
2160 self.eventrelease.ydata = y2
2161 xy2 = self.ax.transData.transform_point([x2, y2])
2162 self.eventrelease.x, self.eventrelease.y = xy2
2163
2164 if self.spancoords == 'data':
2165 xmin, ymin = self.eventpress.xdata, self.eventpress.ydata
2166 xmax, ymax = self.eventrelease.xdata, self.eventrelease.ydata
2167 # calculate dimensions of box or line get values in the right
2168 # order
2169 elif self.spancoords == 'pixels':
2170 xmin, ymin = self.eventpress.x, self.eventpress.y
2171 xmax, ymax = self.eventrelease.x, self.eventrelease.y
2172 else:
2173 raise ValueError('spancoords must be "data" or "pixels"')
2174
2175 if xmin > xmax:
2176 xmin, xmax = xmax, xmin
2177 if ymin > ymax:
2178 ymin, ymax = ymax, ymin
2179
2180 spanx = xmax - xmin
2181 spany = ymax - ymin
2182 xproblems = self.minspanx is not None and spanx < self.minspanx
2183 yproblems = self.minspany is not None and spany < self.minspany
2184
2185 # check if drawn distance (if it exists) is not too small in
2186 # either x or y-direction
2187 if self.drawtype != 'none' and (xproblems or yproblems):
2188 for artist in self.artists:
2189 artist.set_visible(False)
2190 self.update()
2191 return
2192
2193 # call desired function
2194 self.onselect(self.eventpress, self.eventrelease)
2195 self.update()
2196
2197 return False
2198
2199 def _onmove(self, event):
2200 """on motion notify event if box/line is wanted"""

Callers

nothing calls this directly

Calls 3

set_visibleMethod · 0.45
transform_pointMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected