Hmm, good to know. Thanks, Chris. =) - Paul
On Wed, Dec 2, 2009 at 8:08 AM, Chris G <[email protected]> wrote: > You can work around the bug with api: > > import maya.cmds as mc > def mnBox(*args): > mc.confirmDialog( title='Confirm', message='Are you sure?', > button=['Yes','No'], defaultButton='Yes', > cancelButton='No',dismissString='No' ) > > import maya.OpenMaya as om > om.MEventMessage.addEventCallback("quitApplication", mnBox) > > - Chris > > On Wed, Dec 2, 2009 at 10:30 AM, Paul Molodowitch <[email protected]> > wrote: > > Looks like it's a bug... this should work since (in your second code > > snippet, anyway), if you simply replace "quitApplication" with another > event > > name - say, "NewSceneOpened" - it will work. And, as you pointed out, > the > > equivalent mel code also works. > > > > One note though - the assignment to the 'mngBox1' variable is > unnecessary. > > For instance, this works just fine: > > > > ############################### > > import maya.cmds as mc > > def mnBox(): > > mc.confirmDialog( title='Confirm', message='Are you sure?', button= > > ['Yes','No'], defaultButton='Yes', cancelButton='No', > > dismissString='No' ) > > > > mc.scriptJob(event=["NewSceneOpened",mnBox]) > > ############################### > > > > The only problem you had in the original snippet was that you called the > > function before placing it in the list. > > > > - Paul > > > > On Mon, Nov 30, 2009 at 9:44 AM, MARCUS <[email protected]> wrote: > >> > >> hi I have been trying to run a simple scriptjob so that when maya > >> closes, the dialog box opens. > >> > >> I can run it in mel but doing in python is different. > >> please help. > >> > >> > >> > >> import maya.cmds as mc > >> ############################################ > >> def mnBox(): > >> mc.confirmDialog( title='Confirm', message='Are you sure?', button= > >> ['Yes','No'], defaultButton='Yes', cancelButton='No', > >> dismissString='No' ) > >> > >> mc.scriptJob(event=["quitApplication",mnBox()]) > >> ############################################## > >> > >> but i realised that mnBox() within the scriptJob line runs the script > >> so i tried : > >> ############################################## > >> import maya.cmds as mc > >> def mnBox(): > >> mc.confirmDialog( title='Confirm', message='Are you sure?', button= > >> ['Yes','No'], defaultButton='Yes', cancelButton='No', > >> dismissString='No' ) > >> > >> mngBox1=mnBox > >> > >> mc.scriptJob(event=["quitApplication",mngBox1]) > >> ############################################## > >> but it also fails. anyone knows? > >> please help. > >> thanks in advance > >> > >> -- > >> http://groups.google.com/group/python_inside_maya > > > > -- > > http://groups.google.com/group/python_inside_maya > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
