We will briefly examine another one of the demo applications hosted on the demo.bokeh.org website, namely the Movies application, which presents an Interactive Explorer for Movie Data. We will only examine part of the associated source code, to focus more on the different types of widgets used in the GUI.

We first present a screenshot of part of the movies application.

Plot from movies application
A screenshot demonstrating part of the movies application hosted at demo.bokeh.org, where various widgets provide interactive tools to customize plotted data.

The source code for the movies application is provided as part of the Bokeh demo site, and can be found at in the Bokeh github repository. We will not reproduce all of that source code here, but we include some key parts to focus on. The line numbers have been added to the presentation to facilitate discussion of the code:

The section commented as "# Create Input controls" (lines 10-20) creates a number of different widget objects to support user interactions. Each time any of these widgets is changed, an update callback function is called (lines 24-26).

  • Several of these are Sliders, that can be used to slide through a specified range of values (from start to end), and which are initialized with a default value.
  • Several of these are Select widgets, which we examined previously in the context of the Crossfilter application.
  • Two of these are TextInput widgets, which capture whatever text is entered into the box.
Finally, once all the widgets are created, they are laid out in a column in the GUI (lines 28-30). The layout configuration also includes information about how the components and the GUI is sized to accommodate browser windows of different sizes.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)