MCPcopy Index your code
hub / github.com/python/cpython / adjustScrolls

Method adjustScrolls

Lib/turtle.py:376–390  ·  view source on GitHub ↗

Adjust scrollbars according to window- and canvas-size.

(self)

Source from the content-addressed store, hash-verified

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"""

Callers 3

resetMethod · 0.95
onResizeMethod · 0.95
makeGraphFrameMethod · 0.95

Calls 6

winfo_widthMethod · 0.80
winfo_heightMethod · 0.80
xview_movetoMethod · 0.80
yview_movetoMethod · 0.80
grid_forgetMethod · 0.80
gridMethod · 0.45

Tested by

no test coverage detected