GUI Basics

In this example we wil learn the basic interaction with the plot's user interface.

In [ ]:
import k3d
plot = k3d.plot()
plot += k3d.points([0, 0, 0, 1, 1, 1])
plot.display()

Expected result: A simple plot

View / camera position adjustment

The plot can be adjusted using mouse actions:

  • mouse wheel / scroll controls the zooming in or out
  • dragging with left mouse button rotates the plot (all directions)
  • dragging with right mouse button translates the plot (all directions)
  • dragging with wheel / both mose buttons: zooms in or out (only vertical)

To return to the default camera position, press the "Camera reset" icon from the top-right toolbar

Fullscreen mode

It is possible to switch the plot to fullscreen mode using the "Fullscreen" icon from the toolbar. To exit fullscreen mode press the Esc key (there should be a notification from your browser).

Viewing plots in a detached window

Especially in multiple monitor setups it may be useful to detach the plot to a dedicated window. This is achieved by clicking the "Detach widget" icon.

Downloading current view as PNG

To save a snapshot of the current view, press the "Save screenshot" icon from the toolbar.

The filename will be generated as "K3D-", then a string of digits (technically: decimal timestamp) and then ".png". The PNG file containing the plot's interior (no UI decorations) will be processed as a regular download.

This example was just a short description of the UI interaction with K3D plots. Some of these actions (camera adjustment and screenshot retrieval) can be done programmatically, which will be shown in other examples.

In [ ]: