X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=koperkapel%2Factors%2Fbuttons.py;h=d6e395415f9bcfafc82872e1d04e202335629613;hb=9ac7ed8018955d9a80545c2f523964408d9668d9;hp=dfe0ca73a830c50d2177c8c5d2a93e7142e5292d;hpb=e97ad367d4a1f7f9abcd790636b5b72ea312cb29;p=koperkapel.git 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)