View Full Version : Printing Nodes into a window

11 November 2010, 11:16 AM
Hey, i am new to python programming and need some help. I have been asked to create a window which will contain a list of all the objects, cameras and lights in maya. I have done thos but the nodes print out in the script editor and not in the window that i have created. I need them to be in a clolumn view. I also need to specifiy next to its node name what type of object it is. Any help will be greatly appreciated. Thanks

p, li { white-space: pre-wrap; } import maya.cmds as cmds
window = cmds.window( title="Objects, Cameras and Lights")
lights =
print lights, cmds.listRelatives(object, p=True)
cameras =
print cameras, cmds.listRelatives(Object, p=True)
objects =
print objects, cmds.listRelatives(Object, p=True)

11 November 2010, 04:40 PM
You want to show window after finding your objects, you are displaying your window then looking for objects. To show your objects in the window try something like:

lights = l = True )


window = cmds.window ( title = "")
cmds.columnLayout( columnWidth = 2 )
cmds.text (l = 'lights:')
for light in lights:
cmds.text( l = light )
cmds.text(l = `cmds.objectType( light)` )


11 November 2010, 08:43 AM
Here is a super simple example of using a textScrollList. (much better if you have lots of items)

import maya.cmds as mc
nodes =

window = mc.window(title='Scrollable List Of Selected Nodes')
nodePaneLayout = mc.paneLayout()
nodeScrollList = mc.textScrollList()

for node in nodes:
mc.textScrollList(nodeScrollList, edit=True, append=node)

Again this is very simple, and doesn't address many of the problems you may encounter when writing ui's.

Good Luck.

CGTalk Moderation
11 November 2010, 08:43 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.