In this example, we'll be looking at how to create UIs that contain tabs and how to provide scrollable containers.
Our UI will contain two tabs arranged horizontally, with each tab containing a scrollable column of 20 buttons. The final result will look something like this:
Create a new script, name it tabExample.py
and add the following code:
import maya.cmds as cmds class TabExample: def __init__(self): self.win = cmds.window(title="Tabbed Layout", widthHeight=(300, 300)) self.tabs = cmds.tabLayout() # add first tab firstTab = cmds.columnLayout() cmds.tabLayout(self.tabs, edit=True, tabLabel=[firstTab, 'Simple Tab']) cmds.button(label="Button") cmds.setParent("..") # add second tab, and setup scrolling newLayout = cmds.scrollLayout() cmds.tabLayout(self.tabs, edit=True, tabLabel=[newLayout, 'Scrolling Tab']) cmds.columnLayout() for i in range(20...