Home > Software engineering >  Execute command when UI window is closed | Maya/Python
Execute command when UI window is closed | Maya/Python

Time:10-16

Here’s one I’m hoping should be quite simple:

How can I get my UI window to execute a command when the user closes the window? I’ve created a scriptJob that runs while the window is open and I’d like to run a command to terminate it when the window is closed, and avoid having any scriptJobs running when the tool isn’t in use.

Using Python in Maya2020 Any pointers greatly appreciated

CodePudding user response:

You can add a parentparameter to the scriptJob command to attach the scriptJob to an UI element, have a look at the docs: parent - Attaches this job to a piece of maya UI. When the UI is destroyed, the job will be killed along with it.

  • Related