import holoviews as hv
def box(bounds):
if bounds is None:
b = hv.Bounds((0, 0, 0, 0))
else:
b = hv.Bounds(bounds)
b.opts(alpha=0.2, line_color='black')
return b
stream = hv.streams.BoundsXY()
hv.DynamicMap(box, streams=[stream]).opts(tools=["box_select"], active_tools=["box_select"])