I am building a UI that has three pushButtons, each pushButton calls an
external Module. In theory they should all be wired the same. But on the
third button I get this error.
BTW That 3rd module has two arguments like this: *def
randomlyPlace(stairs=10,birds=10): *
# Error: PySide2.QtCore.QObject.connect(): not enough arguments
# Traceback (most recent call last):
# File "<maya console>", line 5, in <module>
# File "E:\ProfessionalDevelopment\python\Introduction to Python
Scripting in Maya\cgcircuitPython\wk6\wk6_homeWorkUI.py", line 26, in run
# win = GeometryGenerator(parent=getMayaWindow())
# File "E:\ProfessionalDevelopment\python\Introduction to Python
Scripting in Maya\cgcircuitPython\wk6\wk6_homeWorkUI.py", line 70, in
__init__
# self.makeConnections()
# File "E:\ProfessionalDevelopment\python\Introduction to Python
Scripting in Maya\cgcircuitPython\wk6\wk6_homeWorkUI.py", line 82, in
makeConnections
# self.Pbtn_randomlyDistribute.connect(self.randomlyPlaceA)
# TypeError: PySide2.QtCore.QObject.connect(): not enough arguments #
Here is the Code.
# Loading a Qt Designer UI file and editing the loaded widget
import os
import functools
from PySide2 import QtWidgets, QtCore, QtUiTools, QtGui
from shiboken2 import wrapInstance
import maya.cmds as mc
import maya.OpenMayaUI as omui
import makeRobotBug, makeSpiralStairs, randomlyPlace
'''
import thisModule
reload (thisModule)
thisModule.run()
'''
def getMayaWindow():
''' pointer to the maya main window '''
ptr = omui.MQtUtil.mainWindow()
if ptr:
return wrapInstance(long(ptr), QtWidgets.QMainWindow)
def run():
''' builds our UI '''
global win
win = GeometryGenerator(parent=getMayaWindow())
#win.show()
class GeometryGenerator(QtWidgets.QDialog):
def __init__(self,parent=None):
super(GeometryGenerator,self).__init__(parent)
#self.resize(400, 300)
## From Pysideuic compiled code goes here
#############################################################
self.gridLayout = QtWidgets.QGridLayout()
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setContentsMargins(5, 5, 5, 5)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setContentsMargins(5, 5, 5, 5)
self.Pbtn_makeRobot = QtWidgets.QPushButton("MAKE ROBOT")
self.verticalLayout_3.addWidget(self.Pbtn_makeRobot)
self.verticalLayout.addLayout(self.verticalLayout_3)
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
self.verticalLayout_4.setContentsMargins(5, 5, 5, 5)
self.Pbtn_makeStairs = QtWidgets.QPushButton("MAKE STAIRS")
self.verticalLayout_4.addWidget(self.Pbtn_makeStairs)
self.verticalLayout.addLayout(self.verticalLayout_4)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setContentsMargins(5, 5, 5, 5)
self.Pbtn_randomlyDistribute = QtWidgets.QPushButton("Randomly
Place Robot and Spiral Staircase")
self.verticalLayout_2.addWidget(self.Pbtn_randomlyDistribute)
self.verticalLayout.addLayout(self.verticalLayout_2)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
##############################################################
self.setWindowTitle("WIN CONTROLLED IN PYTHON")
self.setLayout(self.gridLayout)
self.show()
self.makeConnections()
self.initialUiState()
def initialUiState(self):
self.Pbtn_makeRobot.toggle()
self.Pbtn_makeStairs.toggle()
self.Pbtn_randomlyDistribute.toggle()
def makeConnections(self):
''' connect events in out UI '''
self.Pbtn_makeRobot.clicked.connect( self.makeRobotBug )
self.Pbtn_makeStairs.clicked.connect(self.makeSpiralStairs)
self.Pbtn_randomlyDistribute.connect(self.randomlyPlaceA)
def makeRobotBug(self):
makeRobotBug.makeRobotBug()
def makeSpiralStairs(self):
makeSpiralStairs.makeSpiralStairs()
def randomlyPlaceA(self):
randomlyPlace.randomlyPlace()
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/af98e4a6-ef13-42b5-8c38-10316d47f7e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.