>From your code the .write(exportData) is going to write all data at once. As Justin pointed out, you'll need to break up the write into smaller pieces so you can increment your progress bar.
There are plenty of good examples in the world showing progress with python. This one should help: http://stackoverflow.com/a/15645088/2216741 -j On Sat, Apr 8, 2017 at 11:27 PM, Justin Israel <[email protected]> wrote: > > > On Sun, Apr 9, 2017, 1:47 AM Virbhadra Gupta <[email protected]> > wrote: > >> here is my code >> >> def exportAnimation(): >> dataForJson = getAnimData(startFrame,endFrame) >> path = cmds. internalVar (utd=True) >> filePath = str (path)+'animaton.VGdata' >> exportData = json.dumps ( dataForJson , sort_keys= True , >> ensure_ascii=True , indent= 2 ) >> File = open( filePath, 'w') >> load = File.write (exportData) >> >> """ >> Here i need to create file writing progressBar >> """ >> #craete progressBar >> gMainProgressBar = maya.mel.eval('$tmp = $gMainProgressBar') >> >> # need to show progress of writing >> >> >> File.close() >> > > Do you only need progress for the act of writing the file? Is the write > going to take a while and not the other steps? Any progress bar > implementation is going to need you to feed it updated progress values to > push it towards 100%. So if this file write really needs a progress bar > then you have to split the writes up into chunks. Then you loop over the > number of chunks, write the bytes and update the progress bar. > > Is this what you meant? Or did you want progress for the entire set of > steps? Can you be more specific about what aspect has you stuck? > > > >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/python_inside_maya/5603bdc6-6781-402e-a372-8cf4fa496bb8% >> 40googlegroups.com >> <https://groups.google.com/d/msgid/python_inside_maya/5603bdc6-6781-402e-a372-8cf4fa496bb8%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ms > gid/python_inside_maya/CAPGFgA2jEYV%3D4%3DRuPhkJQ3yJ%2BYKiFv > eKG7%2Bzo5DnaSCtu-6EYg%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2jEYV%3D4%3DRuPhkJQ3yJ%2BYKiFveKG7%2Bzo5DnaSCtu-6EYg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANESWi3dNEnUL5mXy44EDpdaSsXOAf30xKrLJzvZ3pNK8_nW1Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
