+
+ def see(self,items):
+ x1, y1, x2, y2=apply(self.canvas.bbox, items)
+ while x2 > self.canvas.canvasx(0)+self.canvas.winfo_width():
+ old=self.canvas.canvasx(0)
+ self.canvas.xview_scroll( 1, 'units')
+ # avoid endless loop if we can't scroll
+ if old == self.canvas.canvasx(0):
+ break
+ while y2 > self.canvas.canvasy(0)+self.canvas.winfo_height():
+ old=self.canvas.canvasy(0)
+ self.canvas.yview_scroll( 1, 'units')
+ if old == self.canvas.canvasy(0):
+ break
+ # done in this order to ensure upper-left of object is visible
+ while x1 < self.canvas.canvasx(0):
+ old=self.canvas.canvasx(0)
+ self.canvas.xview_scroll( -1, 'units')
+ if old == self.canvas.canvasx(0):
+ break
+ while y1 < self.canvas.canvasy(0):
+ old=self.canvas.canvasy(0)
+ self.canvas.yview_scroll( -1, 'units')
+ if old == self.canvas.canvasy(0):
+ break