def _on_name_click(event): print_('[inter] clicked name') ax, x, y = event.inaxes, event.xdata, event.ydata if ax is None or x is None: # The click is not in any axis print('... out of axis') else: hs_viewtype = ax.__dict__.get('_hs_viewtype', '') print_(' hs_viewtype=%r' % hs_viewtype) if hs_viewtype == 'chip': cx = ax.__dict__.get('_hs_cx') print('... cx=%r' % cx) viz.show_name(hs, nx, fnum=fnum, sel_cxs=[cx]) select_cx_func(cx) viz.draw()
def interact_name(hs, nx, sel_cxs=[], select_cx_func=None, fnum=5, **kwargs): fig = begin_interaction('name', fnum) def _on_name_click(event): print_('[inter] clicked name') ax, x, y = event.inaxes, event.xdata, event.ydata if ax is None or x is None: # The click is not in any axis print('... out of axis') else: hs_viewtype = ax.__dict__.get('_hs_viewtype', '') print_(' hs_viewtype=%r' % hs_viewtype) if hs_viewtype == 'chip': cx = ax.__dict__.get('_hs_cx') print('... cx=%r' % cx) viz.show_name(hs, nx, fnum=fnum, sel_cxs=[cx]) select_cx_func(cx) viz.draw() viz.show_name(hs, nx, fnum=fnum, sel_cxs=sel_cxs) viz.draw() df2.connect_callback(fig, 'button_press_event', _on_name_click) pass