【发布时间】:2016-04-06 17:18:40
【问题描述】:
我将在 Maya 2016 中使用 Pyside 开始一些 Python UI。
我正在尝试在我的 UI 类中创建一个函数来获取一些小部件的所有值。
这是我班级中涉及的函数 sn-ps:
class UI_Window_to_Rename(uiWindow_form, uiWindow_base):
def __init__(self, parent=getMayaWindow()):
self.create_connections()
def create_connections(self):
self.maxDist_spinBox.valueChanged.connect(self.get_vert_distance)
self.setVerts_btn.clicked.connect(self.get_all_settings)
def get_vert_distance(self, value):
return str(value)
def get_all_settings(self):
# This doesn't work. How to I pass the argument from
# get_vert_distance into this function?
# TypeError: get_vert_distance() takes exactly 2 arguments (1 given)
vert_dist = self.get_vert_distance(value)
我基本上希望get_all_settings 操纵我传入的其他函数的值。但我不知道该怎么做,因为get_vert_distance 使用2 个参数。
有点类似于这个问题,但我认为这更复杂?
Calling a variable from one function to another function in Python
【问题讨论】:
标签: python user-interface pyside maya