1import plotly.graph_objs as go
2from ipywidgets import Output, VBox
3
4fig = go.FigureWidget()
5fig.add_pie(values=[1, 2, 3])
6pie = fig.data[0]
7
8out = Output()
9@out.capture(clear_output=True)
10def handle_click(trace, points, state):
11 print(points.point_inds)
12
13pie.on_click(handle_click)
14
15VBox([fig, out])
16