不懂pyq

2024-06-01 04:20:13 发布

您现在位置:Python中文网/ 问答频道 /正文

如果我的标题听起来很模糊,我提前道歉。。。如果需要,可以随意编辑吗?我现在有点左右为难,上次它还可以工作,但是在主脚本中更改了一些代码之后,ui似乎出现了问题。在

这里有两个脚本,mmvsTool.py(执行脚本)和mmvsToolUI.py(ui界面脚本)

如果我错了,请纠正我,因为我正在使用from PyQt4 import QtCore, QtGui作为PyQt小部件的导入语句,而在脚本中我没有使用过Pyside...什么时候错误似乎在告诉我使用它?在

# Traceback (most recent call last):
#   File "<string>", line 1, in <module>
#   File "/user_data/maya/python/mmvsTool.py", line 14, in __init__
#     self.setupUi( self )
#   File "/user_data/maya/python/mmvsToolUI.py", line 18, in setupUi
#     mmvsFTool.setWindowIcon(icon)
# TypeError: # 'PySide.QtGui.QWidget.setWindowIcon' called with wrong argument types:
#   PySide.QtGui.QWidget.setWindowIcon(QIcon)
# Supported signatures:
  PySide.QtGui.QWidget.setWindowIcon(PySide.QtGui.QIcon)

对错误引用的ui代码的一些了解:

^{pr2}$

主脚本中的部分:

from mmvsToolUI import Ui_mmvsTool

from qtswitch import QtGui
from  maya import cmds as mc, mel as mm
import os

class mmvsFTool( QtGui.QWidget, Ui_mmvsTool ):
    """
    """
    def __init__( self, parent = None ):
        super( mmvsFTool, self ).__init__( parent = parent )
        self.setupUi( self )
        # this does nothing yet
        self.modeWidget.setVisible( False )    

Tags: infrompyimportself脚本uiline