简体   繁体   English

python文件中的kseparator的importError,由pyqt转换为.ui(使用qt designer)

[英]ImportError for kseparator in python file converted from .ui by pyqt ( using qt designer)

The python file converted from .ui created by qt designer shows 由qt designer创建的.ui转换的python文件显示
ImportError: No module named kseparator . ImportError: No module named kseparator code is 代码是

from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(400, 300)
        self.kseparator = KSeparator(Form)
        self.kseparator.setGeometry(QtCore.QRect(50, 60, 231, 16))
        self.kseparator.setObjectName(_fromUtf8("kseparator"))

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(_translate("Form", "Form", None))

from kseparator import KSeparator

The ui in qt designer consist only a kseperator and compiling shows: qt设计器中的ui只包含一个kseperator并编译显示:

from kseparator import KSeparator
ImportError: No module named kseparator

How can i add kseperator module. 我该如何添加kseperator模块。 Is it a module to be installed separately like some python library? 它是一个像一些python库一样单独安装的模块吗? please help... 请帮忙...

The KSeparator class is from KDE, which PyQt does not provide any direct support for. KSeparator类来自KDE,PyQt不提供任何直接支持。

If you want to use the KDE classes in your code, you will need to use PyKDE . 如果要在代码中使用KDE类,则需要使用PyKDE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM