MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / reset

Method reset

Python/Turtle.py:259–274  ·  view source on GitHub ↗

Adjust canvas and scrollbars according to given canvas size.

(self, canvwidth=None, canvheight=None, bg = None)

Source from the content-addressed store, hash-verified

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):

Callers 1

__init__Method · 0.95

Calls 2

adjustScrollsMethod · 0.95
configMethod · 0.80

Tested by

no test coverage detected