我定义了 self,我在同步中没有看到任何错误,你们认为错误是什么?
class colormac:
def __init__(self, color, elmnt=None):
if isinstance(color, dict):
self.attachValues(color)
else:
self.attachValues(toColorObject(color))
if elmnt:
elmnt.style.backgroundColor = self.to_rgb_string()
bockColor= colorcat.colormac("rgb(0, 191, 255)")
TypeError: colormac() takes no arguments
类的说法是错误的,应该是:
class colormac:
...
TypeError
来自类定义语句,而不是来自实例化对象的最后一行。