Fix turtle module: None and int are not comparable, map returns an iterator.

This commit is contained in:
Georg Brandl 2007-09-23 13:37:00 +00:00
parent 8ae62b6094
commit f1368ef904
1 changed files with 5 additions and 5 deletions

View File

@ -531,7 +531,7 @@ class RawPen:
def _goto(self, x1, y1): def _goto(self, x1, y1):
x0, y0 = self._position x0, y0 = self._position
self._position = map(float, (x1, y1)) self._position = (float(x1), float(y1))
if self._filling: if self._filling:
self._path.append(self._position) self._path.append(self._position)
if self._drawing: if self._drawing:
@ -749,25 +749,25 @@ def setup(**geometry):
global _width, _height, _startx, _starty global _width, _height, _startx, _starty
width = geometry.get('width',_width) width = geometry.get('width',_width)
if width >= 0 or width == None: if width is None or width >= 0:
_width = width _width = width
else: else:
raise ValueError("width can not be less than 0") raise ValueError("width can not be less than 0")
height = geometry.get('height',_height) height = geometry.get('height',_height)
if height >= 0 or height == None: if height is None or height >= 0:
_height = height _height = height
else: else:
raise ValueError("height can not be less than 0") raise ValueError("height can not be less than 0")
startx = geometry.get('startx', _startx) startx = geometry.get('startx', _startx)
if startx >= 0 or startx == None: if startx is None or startx >= 0:
_startx = _startx _startx = _startx
else: else:
raise ValueError("startx can not be less than 0") raise ValueError("startx can not be less than 0")
starty = geometry.get('starty', _starty) starty = geometry.get('starty', _starty)
if starty >= 0 or starty == None: if starty is None or starty >= 0:
_starty = starty _starty = starty
else: else:
raise ValueError("startx can not be less than 0") raise ValueError("startx can not be less than 0")