Skip to content

Commit

Permalink
Screen size set to 400x400 #15
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Aug 26, 2024
1 parent 38151d4 commit f57bcb0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions turtleps.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def _warn(*args):
# return Math.sqrt (vec2D [0] * vec2D [0] + vec2D [1] * vec2D [1])


_CFG = {"width" : 0.5, # Screen
"height" : 0.75,
_CFG = {"width" : 400, # 0.5, # Screen
"height" : 400, # 0.75,
"canvwidth" : 400,
"canvheight": 300,
"leftright": None,
Expand Down Expand Up @@ -274,9 +274,9 @@ def __init__(self):
self._turtles = []
self._shapes = {}

self._width = None
self._height = None
self._offset = None
self._width = _CFG["width"]
self._height = _CFG["height"]
self._offset = [_CFG["width"]//2, _CFG["height"]//2]


#self.canvwidth = w
Expand Down Expand Up @@ -384,17 +384,17 @@ def clear(self):

def setup(self, width=_CFG["width"], height=_CFG["height"]):

#self.svg.setAttribute('viewBox', f'0 0 {width} {height}')
self._width = width
#self.svg.setAttribute('viewBox', f'200 200 {width} {height}')
self._width = width
self._height = height

self.update()

def update(self):
"""Perform a TurtleScreen update.
"""
self._width = _defaultElement.offsetWidth
self._height = _defaultElement.offsetHeight
#self._width = _defaultElement.offsetWidth
#self._height = _defaultElement.offsetHeight
self._offset = [self._width // 2, self._height // 2]

self.svg.setAttribute('width', self._width)
Expand Down

0 comments on commit f57bcb0

Please sign in to comment.