MCPcopy Index your code
hub / github.com/bqplot/bqplot / _add_interaction

Function _add_interaction

bqplot/pyplot.py:1045–1073  ·  view source on GitHub ↗

Add the interaction for the specified type. If a figure is passed using the key-word argument `figure` it is used. Else the context figure is used. If a list of marks are passed using the key-word argument `marks` it is used. Else the latest mark that is passed is used as the only m

(int_type, **kwargs)

Source from the content-addressed store, hash-verified

1043
1044
1045def _add_interaction(int_type, **kwargs):
1046 """Add the interaction for the specified type.
1047
1048 If a figure is passed using the key-word argument `figure` it is used. Else
1049 the context figure is used.
1050 If a list of marks are passed using the key-word argument `marks` it
1051 is used. Else the latest mark that is passed is used as the only mark
1052 associated with the selector.
1053
1054 Parameters
1055 ----------
1056 int_type: type
1057 The type of interaction to be added.
1058 """
1059
1060 fig = kwargs.pop('figure', current_figure())
1061 marks = kwargs.pop('marks', [_context['last_mark']])
1062
1063 for name, traitlet in int_type.class_traits().items():
1064 dimension = traitlet.get_metadata('dimension')
1065 if dimension is not None:
1066 # only scales have this attribute in interactions
1067 kwargs[name] = _get_context_scale(dimension)
1068 kwargs['marks'] = marks
1069 interaction = int_type(**kwargs)
1070 if fig.interaction is not None:
1071 fig.interaction.close()
1072 fig.interaction = interaction
1073 return interaction
1074
1075
1076def _get_context_scale(dimension):

Callers 1

_create_selectorFunction · 0.85

Calls 3

current_figureFunction · 0.85
_get_context_scaleFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…