Skip to content

Instantly share code, notes, and snippets.

@jsignell
Created October 15, 2019 14:33
Show Gist options
  • Save jsignell/61a7fd49e95f922753504cbcb0e3ee4b to your computer and use it in GitHub Desktop.
Save jsignell/61a7fd49e95f922753504cbcb0e3ee4b to your computer and use it in GitHub Desktop.
def look_for_class(panel, classname, items=None):
"""
Descend a panel object and find any instances of the given class
"""
if items is None:
items = []
if isinstance(panel, pn.layout.ListPanel):
for p in panel:
items = look_for_class(p, classname, items)
elif isinstance(panel, classname):
items.append(panel)
return items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment