Skip to content

Commit bd9dbfe

Browse files
committed
Clean up picker example
1 parent 9b2da66 commit bd9dbfe

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/Examples.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"from pythreejs import *\n",
1010
"import numpy as np\n",
1111
"from IPython.display import display\n",
12-
"from ipywidgets import HTML, Text\n",
12+
"from ipywidgets import HTML, Text, Output, VBox\n",
1313
"from traitlets import link, dlink"
1414
]
1515
},
@@ -124,9 +124,11 @@
124124
"\n",
125125
"# Set up picking responses:\n",
126126
"# Add a new marker when double-clicking:\n",
127+
"out = Output()\n",
127128
"def f(change):\n",
128129
" value = change['new']\n",
129-
" print('Clicked on %s' % value)\n",
130+
" with out:\n",
131+
" print('Clicked on %s' % (value,))\n",
130132
" point = Mesh(geometry=SphereGeometry(radius=0.05), \n",
131133
" material=MeshLambertMaterial(color='red'),\n",
132134
" position=value)\n",
@@ -143,8 +145,8 @@
143145
" h.value = 'Green point at (%.3f, %.3f, %.3f)' % tuple(change['new'])\n",
144146
"g({'new': hover_point.position})\n",
145147
"hover_picker.observe(g, names=['point'])\n",
146-
"display(h)\n",
147-
"display(renderer)"
148+
"\n",
149+
"display(VBox([h, renderer, out]))"
148150
]
149151
},
150152
{
@@ -153,7 +155,6 @@
153155
"metadata": {},
154156
"outputs": [],
155157
"source": [
156-
"# when we change the z values of the geometry, we need to also change the height map\n",
157158
"surf_g.z = list((-z[::-1]).flat)\n",
158159
"surf.material.map = height_texture(-z[::-1])"
159160
]

0 commit comments

Comments
 (0)