fixed background for entry readonly state #643

This commit is contained in:
Tom Schimansky 2022-12-06 19:16:05 +01:00
parent 7572f095c2
commit 5a17b1243e

View File

@ -167,6 +167,7 @@ class CTkEntry(CTkBaseClass):
outline=self._apply_appearance_mode(self._bg_color)) outline=self._apply_appearance_mode(self._bg_color))
self._entry.configure(bg=self._apply_appearance_mode(self._bg_color), self._entry.configure(bg=self._apply_appearance_mode(self._bg_color),
disabledbackground=self._apply_appearance_mode(self._bg_color), disabledbackground=self._apply_appearance_mode(self._bg_color),
readonlybackground=self._apply_appearance_mode(self._bg_color),
highlightcolor=self._apply_appearance_mode(self._bg_color)) highlightcolor=self._apply_appearance_mode(self._bg_color))
else: else:
self._canvas.itemconfig("inner_parts", self._canvas.itemconfig("inner_parts",
@ -174,6 +175,7 @@ class CTkEntry(CTkBaseClass):
outline=self._apply_appearance_mode(self._fg_color)) outline=self._apply_appearance_mode(self._fg_color))
self._entry.configure(bg=self._apply_appearance_mode(self._fg_color), self._entry.configure(bg=self._apply_appearance_mode(self._fg_color),
disabledbackground=self._apply_appearance_mode(self._fg_color), disabledbackground=self._apply_appearance_mode(self._fg_color),
readonlybackground=self._apply_appearance_mode(self._fg_color),
highlightcolor=self._apply_appearance_mode(self._fg_color)) highlightcolor=self._apply_appearance_mode(self._fg_color))
self._canvas.itemconfig("border_parts", self._canvas.itemconfig("border_parts",
@ -285,7 +287,7 @@ class CTkEntry(CTkBaseClass):
raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks") raise ValueError("'add' argument can only be '+' or True to preserve internal callbacks")
self._entry.bind(sequence, command, add=True) self._entry.bind(sequence, command, add=True)
def unbind(self, sequence, funcid=None): def unbind(self, sequence=None, funcid=None):
""" called on the tkinter.Entry """ """ called on the tkinter.Entry """
if funcid is not None: if funcid is not None:
raise ValueError("'funcid' argument can only be None, because there is a bug in" + raise ValueError("'funcid' argument can only be None, because there is a bug in" +
@ -305,7 +307,7 @@ class CTkEntry(CTkBaseClass):
self._entry.insert(0, self._placeholder_text) self._entry.insert(0, self._placeholder_text)
def _deactivate_placeholder(self): def _deactivate_placeholder(self):
if self._placeholder_text_active: if self._placeholder_text_active and self._entry.cget("state") != "readonly":
self._placeholder_text_active = False self._placeholder_text_active = False
self._entry.config(fg=self._apply_appearance_mode(self._text_color), self._entry.config(fg=self._apply_appearance_mode(self._text_color),