首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maya 2015 PyQt AttributeError

Maya 2015 PyQt AttributeError
EN

Stack Overflow用户
提问于 2014-10-28 22:07:12
回答 1查看 581关注 0票数 0
代码语言:javascript
复制
import maya.OpenMaya as om
import maya.OpenMayaUI as omUI

import sip
from PyQt4 import QtGui, QtCore, uic

import rpIcons_rc

import maya.cmds as cmds
import maya.mel as mel


def getMayaWindow():
#    'Get the maya main window as a QMainWindow instance'
    ptr = omUI.MQtUtil.mainWindow()
    return sip.wrapinstance(long(ptr), QtCore.QObject)

def toQtObject(mayaName):
    '''
    Given the name of a Maya UI element of any type,
    return the corresponding QWidget or QAction.
    If the object does not exist, returns None
    '''
    ptr = omUI.MQtUtil.findControl(mayaName)
    if ptr is None:
        ptr = omUI.MQtUtil.findLayout(mayaName)
    if ptr is None:
        ptr = omUI.MQtUtil.findMenuItem(mayaName)
    if ptr is not None:
        return sip.wrapinstance(long(ptr), QtCore.QObject)

uiFile = ('D:/rpGUI.ui')
form_class, base_class = uic.loadUiType(uiFile)

class myUIClass(form_class, base_class):

    def __init__(self, parent=getMayaWindow()):
        super(myUIClass, self).__init__(parent)
        self.setupUi( self )

        #methods
        self.connectSignals()

    def connectSignals(self):
        """Connect all the UI signals"""
        print "Connect signals"


def runUI():
    global app
    global win
    app=QtGui.qApp
    win = myUIClass()
    win.show()

runUI()

上面的代码给出错误

错误: AttributeError: file C:\Program module第215行:‘Files\Autodesk\Maya2015\Python\lib\site-packages\PyQt4\uic__init__.py’对象没有属性'QMainWindow‘

告诉我到底是怎么回事?谢谢

EN

回答 1

Stack Overflow用户

发布于 2014-10-30 06:36:28

尝试使用Pyside。Maya 2015自带Pyside。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26610400

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档