On Thu, Mar 15, 2018, 1:13 AM Virbhadra Gupta <[email protected]> wrote:
> Hey this sample of my code > > wid= newWin" > mode= True > > cmds.window(wid) > cmds.rowLayout(nc=2, cw=(30,50) > img=cmds.image(image=circle.png) > btn=cmda.button(l="start") > cmds.showWindow(wid) > > def apply(): > global mode > while mode: > time.sleep(0.2) > cmds.image(img, e=True, image="circle.png") > time.sleep(0.2) > cmds.image(img, e=True, image="circlePoly.png") > if not mode: > break > t=threading.Thread(target=apply, args=()) > t.start() > > with this i can run separate thread in maya but this code is not updating > in window i have tried cmds.refresh(win) still it won't work. > How can i hv blink effect with this. > Did you read my earlier reply? It addresses this exact approach. You can't call Maya API commands from another thread. You need to use the executeInMainThreadWithResult to have your call run in the main thread. Also I would advise against using a global variable to stop your thread. Make it a class with an apply method, and a bool field. Then you can tell the instance of that class when to stop. > -- > 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/40d687be-c1af-4d97-8341-dac3d306932c%40googlegroups.com > . > 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/CAPGFgA2aZAYA%2BE1vRANy2OgkD5KGk-DCuwyUVj-Soaywq1dpSA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
