且构网

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

AttributeError:'str'对象没有属性'disable'

更新时间:2023-12-02 23:23:52

您的列表仅包含字符串,您无法对字符串执行.config(),请尝试

your list just contains strings and you can't perform .config() on a string, try

buttons = [PushButton(menu, command=lambda: disable(0), text="x", grid=[0,0])]
buttons += (PushButton(menu, command=lambda: disable(1), text="x", grid=[1,0]))

在创建按钮时,以便列表包含实际的按钮对象

when creating your buttons so the list contains the actual button objects