import k3d
from ipywidgets import interact, IntSlider
model_matrix = [
0.9, 0.1, -0.4, 0.0,
0.0, 0.9, 0.4, 0.0,
0.4, -0.4, 0.9, 0.0,
0.0, 0.0, 0.0, 1.0
]
vertices = [
-10.0, -15.0, 0.0,
-10.0, 5.0, 0.0,
10.0, 5.0, 0.0,
-10.0, -15.0, 0.0,
10.0, -15.0, 0.0,
-10.0, 5.0, 0.0,
0.0, 15.0, 0.0,
10.0, 5.0, 0.0,
10.0, -15.0, 0.0
]
line = k3d.line((0, 0, 0, 5, 10, 15), shader="simple")
lines = k3d.line(vertices, model_matrix=model_matrix, color=0xff0000, width=2.5, shader="simple") + line
plot = k3d.plot(antialias=True, camera_auto_fit=True)
plot += lines
#plot.display()
# plot.camera_auto_fit = False # uncomment in order to keep camera at fixed distance on changes
@interact(color=IntSlider(value=line.color, min=0, max=0xffffff))
def update(color):
line.color = color
interactive(children=(IntSlider(value=255, description='color', max=16777215), Output()), _dom_classes=('widge…
# Not all implementations of WebGL support line width, this may not work:
line.width = 5
plot -= line
plot.objects
plot -= lines
2
import ipywidgets
ipywidgets.version_info