且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python GUI TypeError:'str'对象不可调用

更新时间:2022-06-11 04:04:24

在不看其余代码的情况下,我在中看到了明显的错别字/ Brain-o pow

Without looking at the rest of the code, I see an obvious typo / brain-o in pow:

def pow(self):
    self.opt = 'pow'
    self.op1 = float(self.n.get())
    self.n.set = ('')

最后一行应该是:

    self.n.set('')

不包含 = 部分,以便调用 self.n.set ,而不用字符串替换该函数。 (用字符串替换该函数将导致稍后尝试调用 self.n.set 来产生您看到的错误。)

without the = part, so as to call self.n.set, not to replace the function with a string. (Replacing the function with a string will cause a later attempt to call self.n.set to produce the error you saw.)