Hi,
I´m learning PySide becouse I´m writing an autorig. Now I´m in the UI creation.
I´m having some problems trying to change the button text when I click on the button.
The main reason is to get the seleted join name in the text for this button.
I guess it´s a minor thing, but I´m missing some concept I don´t realise, so a little bit of help It would be very handy.
I appreciate it.
Cheers
from PySide import QtGui
import maya.OpenMayaUI as mui
import shiboken
def getMayaWindow():
pointer = mui.MQtUtil.mainWindow()
return shiboken.wrapInstance(long(pointer), QtGui.QWidget)
def createUI():
objectName = 'testWin'
if cmds.window('testWin', exists = True):
cmds.deleteUI('testWin', wnd = True)
parent = getMayaWindow()
window = QtGui.QMainWindow(parent)
window.setObjectName(objectName)
window.setWindowTitle('Title')
mainWidget = QtGui.QWidget()
window.setCentralWidget(mainWidget)
verticalLayout = QtGui.QVBoxLayout(mainWidget)
layout2 = QtGui.QHBoxLayout()
verticalLayout.addLayout(layout2)
button = QtGui.QPushButton('None')
verticalLayout.addWidget(button)
button.clicked.connect(changeName)
window.show()
def changeName():
button.setText('22')
createUI()