Unable to get UI to work

60 views
Skip to first unread message

yann19

unread,
Nov 11, 2015, 10:30:21 PM11/11/15
to Python Programming for Autodesk Maya
Hi all. I have drafted up a UI using the Qt Designer, converted from .ui into .py however while I am trying to use it in my main code, I keep getting into error where it state line 16 (the first line that indicates formLayoutWidget_3), fyi I have saved the ui file as "migToolUI"

from PyQt4 import QtCore, QtGui

class Ui_migTool(object):
   
def setupUi(self, migTool):
       
migTool.setObjectName("migTool")
       
migTool.resize(305, 450)
       
self.formLayoutWidget_3 = QtGui.QWidget(migTool)
       
self.formLayoutWidget_3.setGeometry(QtCore.QRect(0, 10, 301, 441))
       
self.formLayoutWidget_3.setObjectName("formLayoutWidget_3")


This is the main code that I am trying to execute from.


from PySide import QtCore
from PySide import QtGui

import sys
import maya.cmds as cmds
import pymel.core as pm

import migToolUI
reload
(migToolUI)

class migUI(QtGui.QWidget):
   
def __init__(self, parent=None):
       
QtGui.QWidget.__init__(self, parent = None, modal = False)
       
self.ui = migToolUI.Ui_migTool()
       
self.ui.setupUi(self)

The following is the error that I keep getting from Maya:
# Error: TypeError: file /user_data/migToolUI.py line 16: QWidget(QWidget parent=None, Qt.WindowFlags flags=0): argument 1 has unexpected type 'migUI' #

Any advice is greatly appreciated!

Justin Israel

unread,
Nov 11, 2015, 10:45:54 PM11/11/15
to Python Programming for Autodesk Maya
Can you also show the code you are using to launch this code?

I'm not sure if this will help, but can you try modifying that first line in your migUI __init__() to:

QtGui.QWidget.__init__(self, parent)

The way you are doing it now doesn't seem like a proper constructor call. 

--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d645fb7c-7976-4e20-a101-9d60cc4fec10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

yann19

unread,
Nov 11, 2015, 10:58:31 PM11/11/15
to Python Programming for Autodesk Maya
Tried it, same error too.
Truth be told, I am reusing back the same constructor as it was in which it is working in other scripts of mine..

This is how I launch the code:

import sys
sys
.path.insert(0, '/user_data')
import mig
reload
(mig)

win
= mig.migUI()
win
.show()
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

Justin Israel

unread,
Nov 11, 2015, 11:03:18 PM11/11/15
to Python Programming for Autodesk Maya
Would you mind posting a gist of a small but complete example of the crash? I am happy to give it a test over here.

To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3f04b8ab-8e09-490c-89fa-7ce357e479a6%40googlegroups.com.

yann19

unread,
Nov 11, 2015, 11:15:02 PM11/11/15
to Python Programming for Autodesk Maya

Justin Israel

unread,
Nov 11, 2015, 11:51:21 PM11/11/15
to Python Programming for Autodesk Maya
I still haven't tested it yet (need to find a moment), but right off the bat I can see you are mixing PySide and PyQt4 in your import statements. Fix that and give it a shot.

--
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 python_inside_m...@googlegroups.com.

Justin Israel

unread,
Nov 12, 2015, 9:43:59 PM11/12/15
to Python Programming for Autodesk Maya
So did that fix it for you? If not, I was going to try out your code, with the imports corrected.

yann19

unread,
Nov 13, 2015, 1:40:23 AM11/13/15
to Python Programming for Autodesk Maya
Thanks for getting back. I tried correcting the imports, however it is still not working, unfortunately.

Justin Israel

unread,
Nov 13, 2015, 2:33:08 AM11/13/15
to Python Programming for Autodesk Maya
I tried to give this a test... but I am seeing a problem in the UI file. It seems like formLayout_3 object is trying to use API calls from both the QFormLayout, and a QGridLayout? I get errors about QFormLayout not having some of the addLayout() calls it is trying to do. Also, I would think that after you had fixed those PySide vs PyQt4 mismatches...you would have gotten different errors. Is that not the case? 


On Fri, Nov 13, 2015 at 7:40 PM yann19 <yang...@gmail.com> wrote:
Thanks for getting back. I tried correcting the imports, however it is still not working, unfortunately.

--
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 python_inside_m...@googlegroups.com.

yann19

unread,
Nov 17, 2015, 3:25:02 AM11/17/15
to Python Programming for Autodesk Maya
There is a problem in my UI file itself where I have grouped my contents within a formLayout and hence it is failing. Upon changing that particular class into QVBoxLayout, everything is working out fine already and so, I suppose that is the case
Reply all
Reply to author
Forward
0 new messages