diff --git a/ipywidgets/widgets/widget.py b/ipywidgets/widgets/widget.py index 6f8b2a5351..4baaeb58a0 100644 --- a/ipywidgets/widgets/widget.py +++ b/ipywidgets/widgets/widget.py @@ -17,6 +17,7 @@ Undefined) from ipython_genutils.py3compat import string_types, PY3 from IPython.display import display +from json import loads as jsonloads, dumps as jsondumps from base64 import standard_b64decode, standard_b64encode @@ -595,8 +596,11 @@ def hold_sync(self): def _should_send_property(self, key, value): """Check the property lock (property_lock)""" to_json = self.trait_metadata(key, 'to_json', self._trait_to_json) + # A roundtrip conversion through json in the comparison takes care of + # idiosyncracies of how python data structures map to json, for example + # tuples get converted to lists. if (key in self._property_lock - and to_json(value, self) == self._property_lock[key]): + and jsonloads(jsondumps(to_json(value, self))) == self._property_lock[key]): return False elif self._holding_sync: self._states_to_send.add(key)