Adjust scrollbars according to window- and canvas-size.
(self)
| 374 | |
| 375 | |
| 376 | def adjustScrolls(self): |
| 377 | """ Adjust scrollbars according to window- and canvas-size. |
| 378 | """ |
| 379 | cwidth = self._canvas.winfo_width() |
| 380 | cheight = self._canvas.winfo_height() |
| 381 | self._canvas.xview_moveto(0.5*(self.canvwidth-cwidth)/self.canvwidth) |
| 382 | self._canvas.yview_moveto(0.5*(self.canvheight-cheight)/self.canvheight) |
| 383 | if cwidth < self.canvwidth or cheight < self.canvheight: |
| 384 | self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, |
| 385 | column=0, rowspan=1, columnspan=1, sticky='news') |
| 386 | self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, |
| 387 | column=1, rowspan=1, columnspan=1, sticky='news') |
| 388 | else: |
| 389 | self.hscroll.grid_forget() |
| 390 | self.vscroll.grid_forget() |
| 391 | |
| 392 | def onResize(self, event): |
| 393 | """self-explanatory""" |
no test coverage detected