tkinter 条目 bg 和状态
tkinter entry bg and state
当状态为只读时,如何更改条目的背景颜色。
self.v6 =StringVar()
self.txtpic6=Entry(self.root,bg="#cd853f", textvariable=self.v6,state="readonly",justify="center")
self.txtpic6.place(relx=0.87,rely=0.4,relwidth=0.04,relheight=0.06)
在此代码中,当我删除 state 属性时,背景颜色不是 working.but,背景颜色有效。
使用 readonlybackground
应该会有帮助。例如:
self.txtpic6=Entry(self.root,bg="#cd853f", textvariable=self.v6,state="readonly",justify="center", readonlybackground='red')
当状态为只读时,如何更改条目的背景颜色。
self.v6 =StringVar()
self.txtpic6=Entry(self.root,bg="#cd853f", textvariable=self.v6,state="readonly",justify="center")
self.txtpic6.place(relx=0.87,rely=0.4,relwidth=0.04,relheight=0.06)
在此代码中,当我删除 state 属性时,背景颜色不是 working.but,背景颜色有效。
使用 readonlybackground
应该会有帮助。例如:
self.txtpic6=Entry(self.root,bg="#cd853f", textvariable=self.v6,state="readonly",justify="center", readonlybackground='red')