我有一个名为ImageWrapper的类和一个名为DDImage的子类,当我调用父类ImageWrapper中实现的方法时,我得到了一个错误:
Traceback (most recent call last):
File "/home/josecarlos/Workspace/python/process/aux.py", line 11, in <module>
main()
File "/home/josecarlos/Workspace/python/process/aux.py", line 8, in main
i.set_text_title((20, i.get_height()-550), "Doble doble #1", (9,30,54))
File "/home/josecarlos/Workspace/python/process/com/images/dd_image.py", line 19, in set_text_title
d = ImageDraw(self.get_image())
TypeError: 'module' object is not callable
图像.py
^{pr2}$dd公司_图像.py
from com.images.image import ImageWrapper
from PIL import ImageFont, ImageDraw
from constants import FONTS
class DDImage(ImageWrapper):
def __init__(self, id_player):
super().__init__(id_player)
def set_title_font(self):
self.fnt = ImageFont.truetype(FONTS.DD_TITLE_FONT, FONTS.DD_TITLE_FONT_SIZE)
def get_title_font(self):
return self.fnt
def set_text_title(self, position, txt, color):
print("tamaño1: {0}".format(self.get_image()))
d = ImageDraw(self.get_image())
d.txt(position, txt, self.get_title_font(), fill=color)
在我的子类DDImage中,当我调用self.get_图像()英寸 d=图像绘制(self.get_图像()). 以前,我用这个方法self.get_图像()在父亲班上,效果很好。如果我在子类中调用相同的方法,那么在这个指令中也可以正常工作:print(“tamaño1:{0}”).format(self.get_图像())我收到了这个消息:
tamaño1: <PIL.Image.Image image mode=RGB size=1200x1814 at 0x7F3E59CD2748>
但当我在ImageDraw()内部调用它时,会出现错误!!!在
我的目录树是:
com/图像/图像.py com/images/dd公司_图像.py在
我使用的是python3.6
我做错什么了?在
目前没有回答
相关问题 更多 >
编程相关推荐