def __init__(self, *args, **kwargs):
PinchView.__init__(self,*args,**kwargs)
# prevent resize from causing redraw until we r ready
self.ready=threading.Lock()
#self.ready.acquire()
self.img_view = ui.ImageView(frame=self.bounds,flex='WH')
self.add_subview(self.img_view)
self.b = io.BytesIO()
#store base xlim and ylim, only update when drag ends
self.xlim=plt.xlim()
self.ylim=plt.ylim()
self.centroid=tuple(self.center) # zoom center
# fast and slow dpi..
self.high_dpi=72.0
self.low_dpi=16
# set output image size to match view size. this probably should be modified to use actual device dpi and size. fonts and line width are based on pts, not pixels
plt.gcf().set_size_inches(self.width/self.high_dpi,self.height/self.high_dpi)
#update plot, ensuring update really happens
self.update_plt(dpi=self.high_dpi, waitForLock=True)
ObjCInstance(self).becomeFirstResponder()
评论列表
文章目录