def set_and_get_xy_limits(self):
canvas_size = self.canvas.GetSize()
num_x_pixels = canvas_size.x
halfsize = (num_x_pixels / 2.0) / self.ztv_frame.zoom_factor
xlim = (self.center.x - halfsize, self.center.x + halfsize)
self.axes.set_xlim(xlim)
num_y_pixels = canvas_size.y
halfsize = (num_y_pixels / 2.0) / self.ztv_frame.zoom_factor
ylim = (self.center.y - halfsize, self.center.y + halfsize)
self.axes.set_ylim(ylim)
self.figure.canvas.draw() # bulk of time in method is spent in this line: TODO: look for ways to make faster
send_change_message = True
if xlim == self.xlim and ylim == self.ylim:
send_change_message = False
self.xlim, self.ylim = xlim, ylim
if send_change_message:
wx.CallAfter(pub.sendMessage, 'primary-xy-limits-changed', msg=None)
return {'xlim':xlim, 'ylim':ylim}
评论列表
文章目录