I created a registered panel in Nuke and I am trying to modify its content by pressing a button in a different Qt Window.
The panel is using the following code :
import nuke
try:
## < Nuke11
import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
except:
## >= Nuke11
import PySide2.QtCore as QtCore
import PySide2.QtGui as QtGui
import PySide2.QtWidgets as QtGui
from PySide2.QtWidgets import QWidget as QWidget
class Example(QtGui.QWidget):
def __init__(self):
super(Example,self).__init__()
self.comboBox = QtGui.QComboBox()
self.comboBox.addItems(['Item 1','Item 2','Item 3','Item 4'])
layout = QtGui.QVBoxLayout(self)
layout.addWidget(self.comboBox)
pane = nuke.getPaneFor("Example.panel")
panels.registerWidgetAsPanel('Example', 'Example',"", True).addToPane(pane)
Now I am opening another window of a different tool. I am trying to create a bridge between the two tools. I want to modify the value of the ComboBox in the panel by pressing a button in my new Window.
Here is the code for the window :
import nuke
try:
## < Nuke11
import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
except:
## >= Nuke11
import PySide2.QtCore as QtCore
import PySide2.QtGui as QtGui
import PySide2.QtWidgets as QtGui
from PySide2.QtWidgets import QWidget as QWidget
def Panel():
class myPanel(QtGui.QWidget):
def __init__(self):
super(myPanel, self).__init__()
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.setFixedWidth(520)
self.setFixedHeight(100)
layout = QtGui.QVBoxLayout(self)
Button = QtGui.QPushButton('Use Item 4')
Button.clicked.connect(self.modifyPanel)
layout.addWidget(Button)
def modifyPanel(self):
print ''
#This is where I am stuck, how to access and modify the Panel
myPanel = myPanel()
myPanel.show()
Panel()
Thanks a lot, Roman
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.