Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 属性错误:';非类型';对象没有属性';隐藏&x27;?_Python_Attributeerror - Fatal编程技术网

Python 属性错误:';非类型';对象没有属性';隐藏&x27;?

Python 属性错误:';非类型';对象没有属性';隐藏&x27;?,python,attributeerror,Python,Attributeerror,我发现很少有解决这个属性错误的方法,但是没有一个能够解决这个错误 def showDiscEntries(self): for i in range(1, 7): self.findChild(QtGui.QLineEdit, "Discipline"+str(i)).hide() self.findChild(QtGui.QLineEdit, "Input"+str(i)).hide() self.fin

我发现很少有解决这个属性错误的方法,但是没有一个能够解决这个错误

def showDiscEntries(self):

        for i in range(1, 7):
            self.findChild(QtGui.QLineEdit, "Discipline"+str(i)).hide()
            self.findChild(QtGui.QLineEdit, "Input"+str(i)).hide()
            self.findChild(QtGui.QLineEdit, "Output"+str(i)).hide()
        self.pushButton11.show()
AttributeError:“非类型”对象没有属性“隐藏”

您在从
self.findChild(…)
返回的节点上调用
hide()


问题是,
self.findChild(…)
返回了
None
(它没有找到您认为会找到的标记),因此您实际上尝试在
None
上调用
hide()

它无法隐藏
None
对象。for循环中的一行返回None。找出哪一个。我尝试更改小部件类型,它工作正常,没有错误,因此可能LineEdit不支持我尝试给出的命令。