我想要在cb1下拉框选中选项为b时,把et1设置为不可编辑
要如何实时检测combobox选中选项的变化呢?
from tkinter import *
from tkinter import ttk
root = Tk()
root.geometry("500x500")
lf1 = LabelFrame(root,text="Text")
lf1.place(x=5,y=5,width=495,height=60)
et1 = Entry(lf1)
et1.place(x=5,y=0,width=480,height=30)
lf2 = LabelFrame(root,text="Ch")
lf2.place(x=5,y=70,width=240,height=60)
cb1 = ttk.Combobox(lf2)
cb1.place(x=5,y=0,width=225,height=30)
cb1["value"] = ("a","b")
cb1.current(0)
cb1["state"] = "readonly"
root.mainloop()
相似问题