| 475 | return TK.PhotoImage(file=filename, master=self.cv) |
| 476 | |
| 477 | def __init__(self, cv): |
| 478 | self.cv = cv |
| 479 | if isinstance(cv, ScrolledCanvas): |
| 480 | w = self.cv.canvwidth |
| 481 | h = self.cv.canvheight |
| 482 | else: # expected: ordinary TK.Canvas |
| 483 | w = int(self.cv.cget("width")) |
| 484 | h = int(self.cv.cget("height")) |
| 485 | self.cv.config(scrollregion = (-w//2, -h//2, w//2, h//2 )) |
| 486 | self.canvwidth = w |
| 487 | self.canvheight = h |
| 488 | self.xscale = self.yscale = 1.0 |
| 489 | |
| 490 | def _createpoly(self): |
| 491 | """Create an invisible polygon item on canvas self.cv) |