self.clearButton.clicked.connect(host.clear(self))
self.clearButton.clicked.connect(host.clear(self))
TypeError: argument 1 has unexpected type 'NoneType'
修改為:
self.clearButton.clicked.connect(lambda:host.clear(self))
def clear(self):
self.textBrowser.clear()
Lambda的基础用法详见Python Lambda,以及請參考从零开始学python | 什么是Lambda函数以及如何使用它们?