Adjust canvas and scrollbars according to given canvas size.
(self, canvwidth=None, canvheight=None, bg = None)
| 356 | self._rootwindow.bind('<Configure>', self.onResize) |
| 357 | |
| 358 | def reset(self, canvwidth=None, canvheight=None, bg = None): |
| 359 | """Adjust canvas and scrollbars according to given canvas size.""" |
| 360 | if canvwidth: |
| 361 | self.canvwidth = canvwidth |
| 362 | if canvheight: |
| 363 | self.canvheight = canvheight |
| 364 | if bg: |
| 365 | self.bg = bg |
| 366 | self._canvas.config(bg=bg, |
| 367 | scrollregion=(-self.canvwidth//2, -self.canvheight//2, |
| 368 | self.canvwidth//2, self.canvheight//2)) |
| 369 | self._canvas.xview_moveto(0.5*(self.canvwidth - self.width + 30) / |
| 370 | self.canvwidth) |
| 371 | self._canvas.yview_moveto(0.5*(self.canvheight- self.height + 30) / |
| 372 | self.canvheight) |
| 373 | self.adjustScrolls() |
| 374 | |
| 375 | |
| 376 | def adjustScrolls(self): |
no test coverage detected