mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Dynamic traits.
This commit is contained in:
parent
b8b1f5dab4
commit
4a7466b9e8
@ -292,6 +292,13 @@ class Widget(LoggingConfigurable):
|
||||
True if the callback should be unregistered."""
|
||||
self._display_callbacks.register_callback(callback, remove=remove)
|
||||
|
||||
def add_trait(self, traitname, trait):
|
||||
"""Dynamically add a trait attribute to the Widget."""
|
||||
super(Widget, self).add_trait(traitname, trait)
|
||||
if trait.get_metadata('sync'):
|
||||
self.keys.append(traitname)
|
||||
self.send_state(traitname)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Support methods
|
||||
#-------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user