如果我以后将flashlight_show指定为“隐藏”,我想删除/隐藏手电筒按钮。但是我不确定该怎么做。我一直在环顾四周,却找不到答案。
healthKit_show = "show"
flashlight_show = "show"
def supplies_buttons():
supplies_showing = 1
flashlight_var = Button(Supplies, text = "Flashlight", command=flashlight)
healthKit_var = Button(Supplies, text = "healthKit", command=healthKit)
if flashlight_show == "show":
flashlight_var.grid(row=supplies_showing, column=0, sticky=W)
supplies_showing = supplies_showing + 1
if not flashlight_show == "show":
flashlight_var.pack_forget()
if healthKit_show == "show":
healthKit_var.grid(row=supplies_showing, column=0, sticky=W)
supplies_showing = supplies_showing + 1
if not flashlight_show == "show":
healthKit_var.pack_forget()
supplies_buttons()
flashlight_show = "hide"
supplies_buttons()