I have a class using multiple properties (). Change the font, size or line of text, etc. It will require re-rendering of the surface for caching.
What is the recommended way to call the class's own property () inside init ? The problem is that the variable was not set while I want to call @property DrawText.text
If I set ._text directly, it starts:
class DrawText(object): """works, Except ignores text.setter""" def __init__(self):
This also works closer, but will it work with multiple instances using different data?
class DrawText(object): """works, Except ignores text.setter""" def __init__(self): DrawText.text = "default" self.text = "works" @property def text(self): '''plain-text string property''' return self._text @text.setter def text(self, text): if self._text == text: return self._text = text self.dirty = True
source share