Adjust canvas and scrollbars according to given canvas size.
(self, canvwidth=None, canvheight=None, bg = None)
| 257 | self._rootwindow.bind('<Configure>', self.onResize) |
| 258 | |
| 259 | def reset(self, canvwidth=None, canvheight=None, bg = None): |
| 260 | """Adjust canvas and scrollbars according to given canvas size.""" |
| 261 | if canvwidth: |
| 262 | self.canvwidth = canvwidth |
| 263 | if canvheight: |
| 264 | self.canvheight = canvheight |
| 265 | if bg: |
| 266 | self.bg = bg |
| 267 | self._canvas.config(bg=bg, |
| 268 | scrollregion=(-self.canvwidth//2, -self.canvheight//2, |
| 269 | self.canvwidth//2, self.canvheight//2)) |
| 270 | self._canvas.xview_moveto(0.5*(self.canvwidth - self.width + 30) / |
| 271 | self.canvwidth) |
| 272 | self._canvas.yview_moveto(0.5*(self.canvheight- self.height + 30) / |
| 273 | self.canvheight) |
| 274 | self.adjustScrolls() |
| 275 | |
| 276 | |
| 277 | def adjustScrolls(self): |
no test coverage detected