Odd, your code worked perfectly for me... or at least it did once I removed the line breaks which were (I assume) introduced in the email formatting.
Ie, this ran just fine for me: http://pastebin.com/f1369e0f2 Perhaps you could give the exact syntax error? - Paul On Wed, Oct 22, 2008 at 11:07 AM, jamsession <[EMAIL PROTECTED]> wrote: > > I am trying to get the (user chosen) directory path from a browse > function, but I keep getting a syntax error. This technique works > perfectly in MEL but throws a syntax error in python. Is this a bug, > or is there a better way of doing this in python > > Thanks > Jared > > [code] > > import maya.cmds as cmds > win = "myWindow" > def dirPath(filePath, fileType): > cmds.textFieldButtonGrp('Dir', edit=True, text=str(filePath)) > return 1 > def gui(): > #Creates the window. > if(cmds.window(win, q=1, ex=1)): > cmds.deleteUI(win) > if(cmds.windowPref(win, q=1, ex=1)): > cmds.windowPref(win, r=1) > > cmds.window(win, t="Test Window", w=350, h=150) > cmds.columnLayout("colLyt") > cmds.textFieldButtonGrp('Dir',label='Directory Path', text='Browse > for Directory', buttonLabel='browse', buttonCommand=browseIt) > cmds.showWindow(win) > def browseIt(): > cmds.fileBrowserDialog( m=4, fc=dirPath, ft='directory', > an='Choose Directory') > return > gui() > > [/code] > > > --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---
