我正在尝试使用grid_forget删除我的小部件,我以前在代码中使用过它并且工作正常,但是在这一部分中它不起作用
from tkinter import*
def hfmenureturn():
hotfood.grid_forget()
def hotfood():
hf.grid_forget()
hotfoodhome = Button(order, text = 'Home', bg = 'white', fg = 'black',
font = 'arial 20 bold', command = hfmenureturn)
hotfoodhome.grid(row = 0, column = 0)
order = Tk()
hf = Button (order, text = 'HOT FOOD', bg = 'red2', fg = 'black', font =
'arial 15', width = 43, height = 7, command = hotfood)
hf.grid(row = 1, column = 0, sticky = W)
order.mainloop()
弹出的错误消息是AttributeError:“函数”对象没有属性“ grid_forget”