Skip to content
Advertisement

The Foundry Nuke – Display an animated value on a QLabel

I am currently trying to display a value in a QLabel (QLineEdit would work too) based on a NUKE (or Maya) timeline.

I am using Nuke to run the code and I would like to display the value based on the current frame to display something like this:

The current frame is 1001. If I change to frame 1002, I would like the QLabel to change accordingly.

Is there a way to do that ?

JavaScript

Thanks.

Advertisement

Answer

I’ve written the following code for Mac version of The Foundry Nuke 11.2v4, so there’s a PySide2 module instead of PySide that is for previous versions of Nuke. Also, there are some differences touching QtWidgets vs QtGui. For getting a current frame you have to use nuke.frame().

Here is the example with QLabel:

JavaScript

enter image description here

And here is an example of QMessageBox with dynamically changing value:

JavaScript

The QMessageBox is not modal.

enter image description here

Press on this picture to play a GIF animation!

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement