it does indeed - try this:
def populateProjects():
#populate option menu with project folders
projects= os.listdir(projectsDir)
for project in projects :
cmds.menuItem(label=project , parent="prjOptionMenu")
On Monday, June 4, 2012 2:18:42 PM UTC-7, olheiros wrote:
>
>
> Hi guys, thanks for the quick reply
>
> this is what i have:
>
> ----code---------------------------------
>
> ...ui stuff
>
> #option menus
> prjOptionMenu=cmds.optionMenu("prjOptionMenu",label="Projects:",
> w=350, h=35,cc=getfiles)
>
> ...
>
> def populateProjects():
>
> #populate option menu with project folders
> projects= os.listdir(projectsDir)
> for project in projects :
> cmds.menuItem(project , parent="prjOptionMenu")
>
>
> ----------------------------------------------------------------------------------------
>
> if i print out the projects list it gives me correct naming. My guess is
> it has to do with
> dynamic populate of the items.
>
> thank you very much for the help
> cheers
> Ricardo
>
>
>
>
> On 06/04/2012 09:59 PM, Justin Israel wrote:
>
> Confirmed that it works fine for me as well. That sounds like a result of
> what happens when you try to name maya dag paths with illegal characters
> and it flops them to underscore or removes them.
>
>
>
> On Mon, Jun 4, 2012 at 12:51 PM, jdob <[email protected]> wrote:
>
>> The problem may not be with optionMenu(). The following example works
>> fine (for me).
>>
>> window = cmds.window()
>>
>> cmds.columnLayout()
>>
>> cmds.optionMenu( label='Colors', changeCommand=printNewMenuItem )
>>
>> cmds.menuItem( label='Yellow.Blue' )
>>
>> cmds.menuItem( label='Purple-Orange' )
>>
>> cmds.showWindow( window )
>>
>> How are you getting the list of folder names? Can you include a short
>> example of what you're doing?
>>
>>
>>
>> On Monday, June 4, 2012 12:38:33 PM UTC-7, olheiros wrote:
>>>
>>>
>>> Hi all.
>>>
>>> I'm trying to dynamically fill an optionMenu with folder names in my
>>> dir, using maya cmds, but it
>>> seems it doesn't like characters like "." or "-". It always changes to
>>> "_". Is this just me or any of came
>>> across this issue.
>>>
>>> i tried on linux and mac MAYA 2012 x64 SAP
>>>
>>> i wouldn't bother if i didn't had to query those later and the folder
>>> names don't match ! :(
>>>
>>> best regards
>>>
>>> --
>>> ////////////////////////////////////////////////////////////
>>> Ricardo Viana
>>>
>>>
>>> --
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings:
>> http://groups.google.com/group/python_inside_maya/subscribe
>>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
>
>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe