Show More
@@ -40,12 +40,17 b' class ButtonWidget(Widget):' | |||||
40 |
|
40 | |||
41 |
|
41 | |||
42 | def on_click(self, callback, remove=False): |
|
42 | def on_click(self, callback, remove=False): | |
43 | """Register a callback to execute when the button is clicked. |
|
43 | """Register a callback to execute when the button is clicked. The | |
|
44 | callback can either accept no parameters or one sender parameter: | |||
|
45 | - callback() | |||
|
46 | - callback(sender) | |||
|
47 | If the callback has a sender parameter, the ButtonWidget instance that | |||
|
48 | called the callback will be passed into the method as the sender. | |||
44 |
|
49 | |||
45 | Parameters |
|
50 | Parameters | |
46 | ---------- |
|
51 | ---------- | |
47 | remove : bool (optional) |
|
52 | remove : bool (optional) | |
48 | Set to tru to remove the callback from the list of callbacks.""" |
|
53 | Set to true to remove the callback from the list of callbacks.""" | |
49 | if remove: |
|
54 | if remove: | |
50 | self._click_handlers.remove(callback) |
|
55 | self._click_handlers.remove(callback) | |
51 | else: |
|
56 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now