mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Fix AttributeError: 'module' object has no attribute 'isNumberType'
This commit is contained in:
parent
6cc2942ca9
commit
1f41e25b4f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user