From: Simon Cross Date: Sun, 28 Feb 2016 21:37:51 +0000 (+0200) Subject: Hackish support for highlight text buttons. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=bb8628fa8fb822e963e48c617ebbfdfdae634b6a;p=koperkapel.git Hackish support for highlight text buttons. --- diff --git a/koperkapel/actors/buttons.py b/koperkapel/actors/buttons.py index dfe0ca7..d6e3954 100644 --- a/koperkapel/actors/buttons.py +++ b/koperkapel/actors/buttons.py @@ -5,8 +5,18 @@ from .surf import SurfActor 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)