projects
/
koperkapel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8d0a38e
)
Hackish support for highlight text buttons.
author
Simon Cross
<hodgestar@gmail.com>
Sun, 28 Feb 2016 21:37:51 +0000
(23:37 +0200)
committer
Simon Cross
<hodgestar@gmail.com>
Sun, 28 Feb 2016 21:37:51 +0000
(23:37 +0200)
koperkapel/actors/buttons.py
patch
|
blob
|
history
diff --git
a/koperkapel/actors/buttons.py
b/koperkapel/actors/buttons.py
index dfe0ca73a830c50d2177c8c5d2a93e7142e5292d..d6e395415f9bcfafc82872e1d04e202335629613 100644
(file)
--- a/
koperkapel/actors/buttons.py
+++ b/
koperkapel/actors/buttons.py
@@
-5,8
+5,18
@@
from .surf import SurfActor
class TextButton(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)