MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / adjustScrolls

Method adjustScrolls

tools/python-3.11.9-amd64/Lib/turtle.py:380–394  ·  view source on GitHub ↗

Adjust scrollbars according to window- and canvas-size.

(self)

Source from the content-addressed store, hash-verified

378
379
380 def adjustScrolls(self):
381 """ Adjust scrollbars according to window- and canvas-size.
382 """
383 cwidth = self._canvas.winfo_width()
384 cheight = self._canvas.winfo_height()
385 self._canvas.xview_moveto(0.5*(self.canvwidth-cwidth)/self.canvwidth)
386 self._canvas.yview_moveto(0.5*(self.canvheight-cheight)/self.canvheight)
387 if cwidth < self.canvwidth or cheight < self.canvheight:
388 self.hscroll.grid(padx=1, in_ = self, pady=1, row=1,
389 column=0, rowspan=1, columnspan=1, sticky='news')
390 self.vscroll.grid(padx=1, in_ = self, pady=1, row=0,
391 column=1, rowspan=1, columnspan=1, sticky='news')
392 else:
393 self.hscroll.grid_forget()
394 self.vscroll.grid_forget()
395
396 def onResize(self, event):
397 """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