ztv.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码
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}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号