Fix AttributeError: 'module' object has no attribute 'isNumberType'

This commit is contained in:
Christoph Gohlke 2013-03-16 09:16:54 -07:00
parent 6cc2942ca9
commit 1f41e25b4f

View File

@ -30,6 +30,8 @@
# See the README file for information on usage and redistribution. # See the README file for information on usage and redistribution.
# #
import numbers
from PIL import Image, ImageColor from PIL import Image, ImageColor
try: try:
@ -98,7 +100,7 @@ class ImageDraw:
) )
if Image.isStringType(ink): if Image.isStringType(ink):
ink = ImageColor.getcolor(ink, self.mode) ink = ImageColor.getcolor(ink, self.mode)
if self.palette and not Image.isNumberType(ink): if self.palette and not isinstance(ink, numbers.Number):
ink = self.palette.getcolor(ink) ink = self.palette.getcolor(ink)
self.ink = self.draw.draw_ink(ink, self.mode) self.ink = self.draw.draw_ink(ink, self.mode)
@ -141,13 +143,13 @@ class ImageDraw:
if ink is not None: if ink is not None:
if Image.isStringType(ink): if Image.isStringType(ink):
ink = ImageColor.getcolor(ink, self.mode) ink = ImageColor.getcolor(ink, self.mode)
if self.palette and not Image.isNumberType(ink): if self.palette and not isinstance(ink, numbers.Number):
ink = self.palette.getcolor(ink) ink = self.palette.getcolor(ink)
ink = self.draw.draw_ink(ink, self.mode) ink = self.draw.draw_ink(ink, self.mode)
if fill is not None: if fill is not None:
if Image.isStringType(fill): if Image.isStringType(fill):
fill = ImageColor.getcolor(fill, self.mode) fill = ImageColor.getcolor(fill, self.mode)
if self.palette and not Image.isNumberType(fill): if self.palette and not isinstance(fill, numbers.Number):
fill = self.palette.getcolor(fill) fill = self.palette.getcolor(fill)
fill = self.draw.draw_ink(fill, self.mode) fill = self.draw.draw_ink(fill, self.mode)
return ink, fill return ink, fill