# PyTabWidget¶

## Synopsis¶

A PyTabWidget is one of the GUI pane onto which the user can dock tabs such as the NodeGraph, CurveEditor… See detailed description…

## Detailed Description¶

The PyTabWidget class is used to represent panes visible in the user interface:

On the screenshot above, each PyTabWidget is surrounded by a red box.

You cannot construct tab widgets on your own, you must call one of the splitVertically() or splitHorizontally() functions to make a new one based on another existing ones.

By default the GUI of Natron cannot have less than 1 tab widget active, hence you can always split it to make new panes.

To retrieve an existing PyTabWidget you can call the getTabWidget(scriptName) function of GuiApp.

pane1 = app.getTabWidget(“Pane1”)

Note that the script-name of a pane can be seen on the graphical user interface by hovering the mouse over the “Manage layout” button (in the top left hand corner of a pane).

### Managing tabs¶

To insert tabs in the TabWidget you can call either appendTab(tab) or insertTab(index,tab).

Warning

Note that to insert a tab, it must be first removed from the tab into which it was.

To remove a tab, use the function removeTab(tab) on the parent PyTabWidget

For convenience to move tabs around, there is a moveTab(tab,pane) function in GuiApp.

The function closeTab(index) can be used to close permanently a tab, effectively destroying it.

To change the current tab, you can use one of the following functions:

• setCurrentIndex(index)<NatronGui.PyTabWidget.setCurrentIndex>
• setNextTabCurrent()<NatronGui.PyTabWidget.setNextTabCurrent>

To float the current tab into a new floating window, use the floatCurrentTab()<NatronGui.PyTabWidget.floatCurrentTab> function.

### Managing the pane¶

To close the pane permanently, use the closePane()<NatronGui.PyTabWidget.closePane> function. To float the pane into a new floating window with all its tabs, use the floatPane() function.

### Member functions description¶

NatronGui.PyTabWidget.appendTab(tab)
Parameters: tab – QWidget

Appends a new tab to the tab widget and makes it current.

NatronGui.PyTabWidget.closeCurrentTab()

Closes the current tab, effectively destroying it.

NatronGui.PyTabWidget.closeTab(index)

Closes the tab at the given index, effectively destroying it.

NatronGui.PyTabWidget.closePane()

Closes this pane, effectively destroying it. Note that all tabs will not be destroyed but instead moved to another existing pane.

Warning

If this pane is the last one on the GUI, this function does nothing.

NatronGui.PyTabWidget.count()
Return type: int

Returns the number of tabs in this pane.

NatronGui.PyTabWidget.currentWidget()
Return type: QWidget

Returns the current active tab.

NatronGui.PyTabWidget.floatCurrentTab()

Make a new floating window with a single pane and moves the current tab of this pane to the new pane of the floating window.

NatronGui.PyTabWidget.floatPane()

Make a new floating window and moves this pane to the new window (including all tabs).

NatronGui.PyTabWidget.getCurrentIndex()
Return type: int

Returns the index of the current tab. This is 0-based (starting from the left).

NatronGui.PyTabWidget.getScriptName()
Return type: str

Returns the script-name of the pane, as used by the getTabWidget(scriptName) function.

NatronGui.PyTabWidget.getTabLabel(index)
Parameters: index – int str

Returns the name of the tab at the given index if it exists or an empty string otherwise.

NatronGui.PyTabWidget.insertTab(index, tab)
Parameters: tab – QWidget index – int

Inserts the given tab at the given index in this tab-widget.

NatronGui.PyTabWidget.removeTab(tab)
Parameters: tab – QWidget

Removes the given tab from this pane if it is found. Note that this function does not destroy the tab, unlike closeTab(index).

This is used internally by moveTab(tab,pane).

NatronGui.PyTabWidget.removeTab(index)
Parameters: index – int

Same as removeTab(tab) but the index of a tab is given instead.

NatronGui.PyTabWidget.setCurrentIndex(index)
Parameters: index – int

Makes the tab at the given index (0-based) the current one (if the index is valid).

NatronGui.PyTabWidget.setNextTabCurrent()

Set the tab at getCurrentIndex() + 1 the current one. This functions cycles back to the first tab once the last tab is reached.

NatronGui.PyTabWidget.splitHorizontally()
Return type: PyTabWidget

Splits this pane into 2 horizontally-separated panes. The new pane will be returned.

NatronGui.PyTabWidget.splitVertically()
Return type: PyTabWidget

Splits this pane into 2 vertically-separated panes. The new pane will be returned.