I am building a UI. When the button is checked the code should call a 
module called "makeRobotBug" and an object will be placed into my scene.  
It's not working and I am not getting any error messages either, which is 
kind of strange. 

Notice I import makeRobotBug at the to of the script. Then I call it in 
the createGeometry(self) function. 


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*

'''
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.pBtn_makeRobot = QtWidgets.QPushButton("MAKE ROBOT")

        self.verticalLayout.addWidget(self.pBtn_makeRobot)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
        ##############################################################

        self.setWindowTitle("WIN CONTROLLED IN PYTHON")
        self.setLayout(self.gridLayout)
        self.show()
        self.makeConnections()

    def makeConnections(self):
        ''' connect events in out UI '''
        self.pBtn_makeRobot.clicked.connect( self.createGeometry )

    def createGeometry(self):
        print("Create geometry pressed")
        
        if self.pBtn_makeRobot.isChecked():
            *makeRobotBug**.makeRobotBug()*

-- 
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/f5f84975-7091-4d77-827d-8acfdd3fb5c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to