class TextButton(SurfActor):
- def __init__(self, text, **kwargs):
- super(TextButton, self).__init__(getsurf(text, **kwargs))
+ def __init__(self, text, action=None, **kwargs):
+ self.text(text, **kwargs)
+ super(TextButton, self).__init__(self._surf)
+ self.action = action
- def text(self, *args, **kw):
- self.surf = getsurf(*args, **kw)
+ def select(self):
+ self.text(self._text, owidth=2, ocolor="white", color="black")
+
+ def deselect(self):
+ self.text(self._text)
+
+ def text(self, text, **kw):
+ self._text = text
+ self._text_kwargs = kw
+ self.surf = getsurf(text, **kw)