A handle on an updatable display Call `.update(obj)` to display a new object. Call `.display(obj`) to add a new instance of this display, and update existing instances. See Also -------- :func:`display`, :func:`update_display`
| 307 | |
| 308 | |
| 309 | class DisplayHandle: |
| 310 | """A handle on an updatable display |
| 311 | |
| 312 | Call `.update(obj)` to display a new object. |
| 313 | |
| 314 | Call `.display(obj`) to add a new instance of this display, |
| 315 | and update existing instances. |
| 316 | |
| 317 | See Also |
| 318 | -------- |
| 319 | |
| 320 | :func:`display`, :func:`update_display` |
| 321 | |
| 322 | """ |
| 323 | |
| 324 | def __init__(self, display_id=None): |
| 325 | if display_id is None: |
| 326 | display_id = _new_id() |
| 327 | self.display_id = display_id |
| 328 | |
| 329 | def __repr__(self): |
| 330 | return "<%s display_id=%s>" % (self.__class__.__name__, self.display_id) |
| 331 | |
| 332 | def display(self, obj, **kwargs): |
| 333 | """Make a new display with my id, updating existing instances. |
| 334 | |
| 335 | Parameters |
| 336 | ---------- |
| 337 | obj |
| 338 | object to display |
| 339 | **kwargs |
| 340 | additional keyword arguments passed to display |
| 341 | """ |
| 342 | display(obj, display_id=self.display_id, **kwargs) |
| 343 | |
| 344 | def update(self, obj, **kwargs): |
| 345 | """Update existing displays with my id |
| 346 | |
| 347 | Parameters |
| 348 | ---------- |
| 349 | obj |
| 350 | object to display |
| 351 | **kwargs |
| 352 | additional keyword arguments passed to update_display |
| 353 | """ |
| 354 | update_display(obj, display_id=self.display_id, **kwargs) |
| 355 | |
| 356 | |
| 357 | def clear_output(wait=False): |
no outgoing calls
no test coverage detected
searching dependent graphs…