From bb8628fa8fb822e963e48c617ebbfdfdae634b6a Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 28 Feb 2016 23:37:51 +0200 Subject: [PATCH] Hackish support for highlight text buttons. --- koperkapel/actors/buttons.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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) -- 2.34.1