def _pointClick(self, event, pass_fcn):
"""
Capture single mouse click location in MPL window.
After this function completes, it sends the data (x_pt, y_pt) on to \
the pass_fcn function.
"""
if event.button == 1:
if event.inaxes == self.img_BW.mpl.ax:
#self.tempverts += [[event.xdata, event.ydata]]
x_loc = event.xdata
y_loc = event.ydata
# Send on to a function that will use the collected data
pass_fcn((x_loc, y_loc))
self.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.mpl_disconnect(self.cid)
self.cid = None
else: # Clicked out-of-bounds
pass
# print('Clicked out-of-bounds')
else: # Right-or-middle clicked; thus, cancel
self.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.ArrowCursor))
self.img_BW.mpl.mpl_disconnect(self.cid)
self.cid = None
评论列表
文章目录