pymel.core.windows.toolCollection

toolCollection(*args, **kwargs)

This command creates a tool button collection. Collections are parented to the current default layout if no parent is specified with the -p/parent flag. As children of the layout they will be deleted when the layout is deleted. Collections may also span more than one window if the -gl/global flag is used. In this case the collection has no parent and must be explicitly deleted with the ‘deleteUI’ command when it is no longer wanted.

Flags:
Long name (short name) Argument Types Properties
collectionItemArray (cia) bool ../../../_images/query.gif
 

Returns a string list giving the long names of all the items in this collection.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

defineTemplate (dt) unicode ../../../_images/create.gif
 

Puts a command in a mode where any other flags and args are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template.

exists (ex) bool ../../../_images/create.gif
 
Returns true|false depending upon whether the specified object exists. Other flags are ignored.
gl (gl) bool ../../../_images/create.gif ../../../_images/query.gif
 

Set the collection to have no parent layout. This flag must be specified when the collection is created and can not be queried or edited. Consequently, global collections must be explicitly deleted.

| .. |
nci)** | bool | .. image:: /images/query.gif |
 
Returns the number of items that are in this collection.
parent (p) unicode ../../../_images/create.gif
 

Specify the parent to associate the collection with. The collection will be deleted along with the parent. This flag must be specified when the collection is created and can not be edited.

select (sl) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Select the specified collection item. If queried will return the name of the currently selected collection item.
useTemplate (ut) unicode ../../../_images/create.gif
 
Force the command to use a command template other than the current one.

Derived from mel command maya.cmds.toolCollection

Example:

import pymel.core as pm

import maya.cmds as cmds

pm.window()
# Result: ui.Window('window1') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout92') #
pm.toolCollection()
# Result: ui.ToolCollection('window1|columnLayout92|toolCollection3') #
pm.toolButton( tool='selectSuperContext', toolImage1=('selectSuperContext', 'aselect.xpm') )
# Result: ui.ToolButton('window1|columnLayout92|toolButton5') #
pm.toolButton( tool='moveSuperContext', toolImage1=('moveSuperContext', 'move_M.png') )
# Result: ui.ToolButton('window1|columnLayout92|toolButton6') #
pm.toolButton( tool='scaleSuperContext', toolImage1=('scaleSuperContext', 'scale_M.png') )
# Result: ui.ToolButton('window1|columnLayout92|toolButton7') #
pm.showWindow()

Previous topic

pymel.core.windows.toolButton

Next topic

pymel.core.windows.treeLister

Core

Core Modules

Other Modules

This Page