def on_leave_axes(self, event): if event.inaxes is self._slider_ax: # 进入后会创建_slider_cursor,离开后复原 axes = [self.axes[i] for i in self._cursor_axes_index.values()] #axes = list(reversed(axes)) # 很奇怪,如果没有按顺序给出,显示会有问题。 self._cursor = MultiCursor(self._fig.canvas, axes, color='r', lw=2, horizOn=False, vertOn=True) event.canvas.draw() log.debug("on_leave_axes")
def on_enter_axes(self, event): #event.inaxes.patch.set_facecolor('yellow') # 只有当前axes会闪烁。 if event.inaxes is self._slider_ax: #or event.inaxes is self._bigger_picture: self._cursor = None event.canvas.draw() log.debug("on_enter_axes") return
def on_slider(self, val, event): """ 滑块事件处理。 """ if event.name == "button_press_event": self._bigger_picture.set_zorder(1000) self._slider_cursor = MultiCursor(self._fig.canvas, [self._slider_ax, self._bigger_picture], color='y', lw=2, horizOn=False, vertOn=True) log.debug("on_press_event") elif event.name == "button_release_event": self._bigger_picture.set_zorder(0) del self._slider_cursor log.debug("on_release_event") elif event.name == "motion_notify_event": pass # 遍历axes中的每个indicator,计算显示区间。 self._w_left = int(val) self._w_right = self._w_left+self._w_width if self._w_right >= self._data_length: self._w_right = self._data_length - 1 + self._hoffset self._w_left = self._w_right - self._w_width self._update_widgets()
def on_press(self, event): log.debug("button_press_event") pass