GUI¶
Diplotocus features a GUI (Graphical User Interface):

When running diplotocus through this mode, you will make edit your animation through a local web page in your browser. This page communicates with a python server, which links the GUI and diplotocus objects in the background. Hence, everything you can do through python, you can do through the GUI, and vice versa.
Note
The datapoints used in any of the plot objects of your animations have to be created before launching the GUI, as they will be passed to the function that launches the GUI.
- class diplotocus.GUI(timeline=None, plot_objects=None, min_tracks=3, host='localhost', port=8008, open_browser=True)[source]
A Graphical User Interface object that launches a python server that serves a webpage.
- Parameters:
timeline (Timeline) – the Timeline object that renders our animation.
plot_objects (list[dict]) –
- a list of dictionaries containing the keys:
name: the display name shown in the GUI.
object: the plot object.
- new_x/new_y (optional): datapoints to be used when the
morph() animation is used on the plot object.
min_tracks (
int) – the minimum number of tracks to be shown. This will be the initial number of tracks.host (
str) – the URL to which the server serves content.port (
int) – the port used to communicate with the server.open_browser (
bool) – if True, opens the webpage at host:port immediatly after the server is launched.
Here’s an example on how to launch the GUI:
import diplotocus as dpl
import numpy as np
#We define our datapoints
x = np.linspace(0,2*np.pi,100)
y = np.cos(x)
#We create our plot objects
a = dpl.scatter(x,y)
b = dpl.plot(x,y*2)
#We create our timeline
tl = dpl.Timeline(xlim=(0,2*np.pi),ylim=(-1,1))
#We pass our timeline, and a list of dictionaries of our plot objects,
#their display name, and any data that might be used by animations
GUI = dpl.GUI(
timeline=tl,
plot_objects=[
{
'name':'scatter',
'object':a,
'new_x':x,
'new_y':y/2
},
{
'name':'plot',
'object':b
}
])