python 属性错误_python – 这里有什么问题? (属性错误__len__)

import Tkinter

class buttton(Tkinter.Button):

def __init__(self,frame,action=None):

if action==None:

action=self.action

Tkinter.Button.__init__(self,frame,command=action)

self.pack(frame)

def action(self):

None

root=Tkinter.Tk()

button=buttton(root)

root.mainloop()

在运行这个我无法找到任何问题的问题时,我遇到了一个相当神秘的错误……

Traceback (most recent call last):

File "C:/Users/username/Desktop/ab.py", line 14, in

button=buttton(root)

File "C:/Users/username/Desktop/ab.py", line 8, in __init__

self.pack(frame)

File "C:\Python27\lib\lib-tk\Tkinter.py", line 1940, in pack_configure

+ self._options(cnf, kw))

File "C:\Python27\lib\lib-tk\Tkinter.py", line 1162, in _options

cnf = _cnfmerge(cnf)

File "C:\Python27\lib\lib-tk\Tkinter.py", line 114, in _cnfmerge

for c in _flatten(cnfs):

File "C:\Python27\lib\lib-tk\Tkinter.py", line 1898, in __getattr__

return getattr(self.tk, attr)

AttributeError: __len__

如果有任何帮助,我会非常高兴!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值