from PySide import QtGui import maya.OpenMayaUI as mui import shiboken import pymel.core as pm import maya.cmds as cmds from functools import partial def get_maya_window(): pointer = mui.MQtUtil.mainWindow() return shiboken.wrapInstance(long(pointer), QtGui.QWidget) ###---Functions---###a def move_keys(spinBox): spinBoxVal = spinBox.value() curSel = pm.selected() pm.keyframe(curSel, relative=True, tc=(spinBoxVal)) ####---Window code---### windowName = "myWin" #check for window if cmds.window("myWin", exists = True): cmds.deleteUI("myWin", wnd=True) #window parent = get_maya_window() window = QtGui.QMainWindow(parent) window.setObjectName(windowName) window.setWindowTitle("Anim Tools") #font font = QtGui.QFont() font.setPointSize(12) font.setBold(True) #main widget mainWidget = QtGui.QWidget() window.setCentralWidget(mainWidget) #Translate layout translateLayout = QtGui.QHBoxLayout() #Vertical layout verticalLayout = QtGui.QVBoxLayout(mainWidget) parent = get_maya_window() verticalLayout.addLayout(translateLayout) #Label label = QtGui.QLabel("Shift Value:") translateLayout.addWidget(label) #SpinBox spinBox = QtGui.QSpinBox() spinBox.setRange(0,10000) spinBox.setValue(50) translateLayout.addWidget(spinBox) #button button = QtGui.QPushButton("Shift") verticalLayout.addWidget(button) button.setMinimumSize(100,40) button.setFont(font) button.setMaximumSize(400,40) button.setStyleSheet("background-color:rgb(59,248,130); color: black") button.clicked.connect(partial(move_keys, spinBox))# <---------This is where I don't know what to do! #show window window.show()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question