0

I'm beginning some Python UI with Pyside in Maya 2016.

I am trying to make a function in my UI class that gets all the values of a few widgets.

Here's the function snippets from my class that are involved:

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)

I basically want get_all_settings to manipulate the values of other functions I pass in. But I'm not sure how to do that since get_vert_distance uses 2 arguments.

Kind of similar to this question, but I think this is more complex?

Calling a variable from one function to another function in Python

Community
  • 1
  • 1
john
  • 408
  • 9
  • 30

1 Answers1

0

I was going about this wrong. I should have just made a function to query the current value of the maxDist_spinBox widget with:

def get_all_settings(self):
    print self.maxDist_spinBox.value()

https://srinikom.github.io/pyside-docs/PySide/QtGui/QSpinBox.html?highlight=spinbox#PySide.QtGui.PySide.QtGui.QSpinBox.value

john
  • 408
  • 9
  • 30