### Navigation

- index
- previous |
- Tulip-Python v3.8.0 documentation »

# `tulipgui` module API

That module should only be used when working with the Python Script editor integrated in the Tulip software.

## Utility functions

`tlp.``getAvailableViews`()

  New in version 3.8.

  Returns a list of the views names currently available in Tulip.

  Return type: | list of string

`tlp.``addView`(viewName, graph[, dataSet])

  New in version 3.8.

  Creates and adds a new Tulip view. If called through a Python Script editor in the main Tulip GUI, the view will be added in the Tulip workspace. If called through the classical Python shell, a dialog containing the view will be created and displayed. Returns an instance of the newly created view.

  Parameters: | viewName (string) – the name of the view to create (use `tlp.getAvailableViews()` to know which ones are installed) graph (`tulip.tlp.Graph`) – the graph to set on the new view dataSet (`tulip.tlp.Dataset`) – the optional parameters of the view
  Return type: | `tlp.View`

`tlp.``getOpenedViews`()

  New in version 3.8.

  Returns a list of the views currently opened.

  Return type: | list of `tlp.View`

`tlp.``getViewsOfGraph`(graph)

  New in version 3.8.

  Returns a list of views associated to a particular graph.

  Parameters: | graph (`tulip.tlp.Graph`) – the graph on which to find views
  Return type: | list of `tlp.View`

`tlp.``tileViews`()

  New in version 3.8.

  Tiles the opened views in the current workspace (this function has no effect when called from the classical Python shell).

`tlp.``closeView`(view)

  New in version 3.8.

  Closes an opened view.

  Parameters: | view (`tlp.View`) – the view to close

`tlp.``closeAllViews`()

  New in version 3.8.

  Closes all opened views.

`tlp.``closeViewsRelatedToGraph`(graph)

  New in version 3.8.

  Closes all the views associated to a particular graph.

  Parameters: | graph (`tulip.tlp.Graph`) – the graph on which to close views

## tlp.View

class `tlp.``View`

  New in version 3.8.

  This is the base class for Tulip data views. Use the following functions to get instances on such object :

  > - `tlp.addView()`
  > - `tlp.getOpenedViews()`
  > - `tlp.getViewsOfGraph()`

  `draw`()

    Draws/Updates the view.

  `getData`()

    Returns the current parameters of the view.

    Return type: | `tulip.tlp.DataSet`

  `getGraph`()

    Returns the graph currently attached to the view.

    Return type: | `tulip.tlp.Graph`

  `getName`()

    Returns the name of the view.

    Return type: | string

  `savePicture`(picturePath, width, height, center)

    Takes a snapshot of the view (if the view supports it), and saves it to a picture on disk. Returns `True` if the operation succeeds.

    Parameters: | picturePath (string) – the absolute path of the picture file with extension (used to infer image type) width (integer) – the picture width height (integer) – the picture height center (boolean) – if `True`, center the view before taking the snapshot, otherwise use the current zoom and pan level
    Return type: | boolean

  `setData`(graph, dataSet)

    Sets the graph and parameters for the view.

    Parameters: | graph (`tulip.tlp.Graph`) – the graph from which the view will be drawn. dataSet (`tulip.tlp.DataSet`) – the view parameters

  `setGraph`(graph)

    Sets the graph for the view. The current parameters will be kept.

    Parameters: | graph (`tulip.tlp.Graph`) – the graph from which the view will be drawn.

## tlp.NodeLinkDiagramComponent

class `tlp.``NodeLinkDiagramComponent`

  New in version 3.8.

  Bases: `tlp.View`

  That class represents the main type of view offered by Tulip : a node link diagram.

  `centerView`()

    Centers the view according to the current view window size and draws it.

  `geCenterViewOnSetGraph`()

    Returns the state of the automatic centering when setting a new graph on the view.

    Return type: | boolean

  `getRenderingParameters`()

    Returns a copy of the current rendering parameters for the node link diagram view.

    Return type: | `tulipogl.tlp.GlGraphRenderingParameters`

  `hideOverview`(hideOverview)

    Hides / displays the overview in the top left corner of the view.

    Parameters: | hideOverview (boolean) – whether to hide the overview

  `setCenterViewOnSetGraph`(center)

    Activates / desactivates the automatic centering of the view when setting a new graph on it.

    Parameters: | center (boolean) – the state of the automatic centering

  `setRenderingParameters`(parameters)

    Sets the rendering parameters for the node link diagram view.

    Parameters: | parameters (`tulipogl.tlp.GlGraphRenderingParameters`) – the new rendering parameters

### Navigation

- index
- previous |
- Tulip-Python v3.8.0 documentation »