IPython widget Dict not syncing

Aaron Watters <[email protected]> Thu, 27 Aug 2015 13:05:06 +0000
Newsgroups gmane.comp.python.ipython.user
Message-ID <D2048342.261%[email protected]>
--===============1004738634==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_D2048342261awatterssimonsfoundationorg_"

--_000_D2048342261awatterssimonsfoundationorg_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm playing around with I-Python interactive widgets - very cool!

I'm having trouble passing dictionaries from the Python side to the JS side=
.
For some reason I can get a List to sync from the python side to the javasc=
ript side like so:

Py:    commands =3D List([], sync=3DTrue)

Js:  var commands =3D this.model.get("commands");

But the same doesn't seem to work with Dict

Py:      style =3D Dict({}, sync=3DTrue)

I'm pretty sure I'm using JSON compatible values and I'm changing the top l=
evel reference to get traitlets to notice that the value has changed.  I wo=
uldn't rule out that I'm doing something else dumb, however.

For fun I just changed the code to pass a dictionary wrapped in a list and =
it worked.  Any idea what is wrong?  Thanks!
  - Aaron Watters


--_000_D2048342261awatterssimonsfoundationorg_
Content-Type: text/html; charset="iso-8859-1"
Content-ID: <[email protected]>
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
</head>
<body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-lin=
e-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-fami=
ly: Calibri, sans-serif;">
<div>I&#8217;m playing around with I-Python interactive widgets &#8212; ver=
y cool!</div>
<div><br>
</div>
<div>I&#8217;m having trouble passing dictionaries from the Python side to =
the JS side.</div>
<div>For some reason I can get a List to sync from the python side to the j=
avascript side like so:</div>
<div>
<div><br>
</div>
<div>Py: &nbsp; &nbsp;commands =3D List([], sync=3DTrue)</div>
</div>
<div><br>
</div>
<div>Js:&nbsp; var commands =3D this.model.get(&quot;commands&#8221;);</div=
>
<div><br>
</div>
<div>But the same doesn&#8217;t seem to work with Dict</div>
<div><br>
</div>
<div>Py: &nbsp;&nbsp; &nbsp; style =3D Dict({}, sync=3DTrue)</div>
<div><br>
</div>
<div>I&#8217;m pretty sure I&#8217;m using JSON compatible values and I&#82=
17;m changing the top level reference to get traitlets to notice that the v=
alue has changed. &nbsp;I wouldn&#8217;t rule out that I&#8217;m doing some=
thing else dumb, however.</div>
<div><br>
</div>
<div>For fun I just changed the code to pass a dictionary wrapped in a list=
 and it worked. &nbsp;Any idea what is wrong? &nbsp;Thanks!</div>
<div>&nbsp; &#8212; Aaron Watters</div>
<div><br>
</div>
</body>
</html>

--_000_D2048342261awatterssimonsfoundationorg_--

--===============1004738634==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
IPython-User mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/ipython-user

--===============1004738634==--