Merge
[koperkapel.git] / koperkapel / actors / buttons.py
1 """ Buttons. """
2
3 from pgzero.ptext import getsurf
4 from .surf import SurfActor
5
6
7 class TextButton(SurfActor):
8     def __init__(self, text, action=None, **kwargs):
9         self.text(text, **kwargs)
10         super(TextButton, self).__init__(self._surf)
11         self.action = action
12
13     def select(self):
14         self.text(self._text, owidth=2, ocolor="white", color="black")
15
16     def deselect(self):
17         self.text(self._text)
18
19     def text(self, text, **kw):
20         self._text = text
21         self._text_kwargs = kw
22         self.surf = getsurf(text, **kw)