Show More
@@ -43,24 +43,6 b' class StringWidget(Widget):' | |||||
43 | self._comm.send({"method": "scroll_to_bottom"}) |
|
43 | self._comm.send({"method": "scroll_to_bottom"}) | |
44 |
|
44 | |||
45 |
|
45 | |||
46 | def on_click(self, callback, remove=False): |
|
|||
47 | """Register a callback to execute when the button is clicked. The |
|
|||
48 | callback can either accept no parameters or one sender parameter: |
|
|||
49 | - callback() |
|
|||
50 | - callback(sender) |
|
|||
51 | If the callback has a sender parameter, the ButtonWidget instance that |
|
|||
52 | called the callback will be passed into the method as the sender. |
|
|||
53 |
|
||||
54 | Parameters |
|
|||
55 | ---------- |
|
|||
56 | remove : bool (optional) |
|
|||
57 | Set to true to remove the callback from the list of callbacks.""" |
|
|||
58 | if remove: |
|
|||
59 | self._click_handlers.remove(callback) |
|
|||
60 | elif not callback in self._click_handlers: |
|
|||
61 | self._click_handlers.append(callback) |
|
|||
62 |
|
||||
63 |
|
||||
64 | def _handle_string_msg(self, content): |
|
46 | def _handle_string_msg(self, content): | |
65 | """Handle a msg from the front-end |
|
47 | """Handle a msg from the front-end | |
66 |
|
48 |
General Comments 0
You need to be logged in to leave comments.
Login now