summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Królczyk <krzysztof.krolczyk@o2.pl>2019-08-15 18:59:35 +0200
committerKrzysztof Królczyk <krzysztof.krolczyk@o2.pl>2019-08-15 19:07:17 +0200
commit82d6eb8ba29e722016fa9b996fd9f42d2288095e (patch)
tree6dcb35cc41718c1dcd4fba0e52158da308574627
parentbb5498690bb59d1ce995a843f8de7349541e883d (diff)
downloadurwid-82d6eb8ba29e722016fa9b996fd9f42d2288095e.tar.gz
add custom checkbox symbol
-rwxr-xr-xurwid/wimp.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/urwid/wimp.py b/urwid/wimp.py
index 031313e..1e5f009 100755
--- a/urwid/wimp.py
+++ b/urwid/wimp.py
@@ -114,7 +114,7 @@ class CheckBox(WidgetWrap):
signals = ["change", 'postchange']
def __init__(self, label, state=False, has_mixed=False,
- on_state_change=None, user_data=None):
+ on_state_change=None, user_data=None, checked_symbol=None):
"""
:param label: markup for check box label
:param state: False, True or "mixed"
@@ -148,6 +148,8 @@ class CheckBox(WidgetWrap):
self._label = Text("")
self.has_mixed = has_mixed
self._state = None
+ if checked_symbol:
+ self.states[True] = SelectableIcon(u"[%s]" % checked_symbol, 1)
# The old way of listening for a change was to pass the callback
# in to the constructor. Just convert it to the new way:
if on_state_change: