首页 > 解决方案 > 单击其中一个按钮后如何禁用 3 个按钮?

问题描述

以下是输出中的按钮:

在此处输入图像描述

这里是代码中的相同按钮,我想在单击其中一个按钮后禁用它们:

在此处输入图像描述

这是完整的代码:

root = Tk()
root.title("Menu du jeu")
root.geometry("600x300")
root.config(bg="#7f7f7f")


b1 = Button(root, text="Facile", fg='white', bg="black", command=lambda: [commencerJeu1(), root.destroy()])

b1.pack(side="left", ipadx=10, ipady=10)



b2 = Button(root, text="Moyen", fg='blue', bg="black", command=lambda: [commencerJeu2(), root.destroy()])
b2.pack(side="left", ipadx=10, ipady=10)

b3 = Button(root, text="Difficile", fg='orange', bg="black", command=lambda: [commencerJeu3(), root.destroy()])
b3.pack(side="left", ipadx=10, ipady=10)

b4 = Button(root, text="fermer", fg='yellow', bg="black", command=root.destroy)
b4.pack(side="right", ipadx=10, ipady=10)


root.mainloop()

标签: pythontkinter

解决方案


推荐阅读