简体   繁体   中英

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
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:

from kseparator import KSeparator
ImportError: No module named kseparator

How can i add kseperator module. Is it a module to be installed separately like some python library? please help...

The KSeparator class is from KDE, which PyQt does not provide any direct support for.

If you want to use the KDE classes in your code, you will need to use PyKDE .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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