From 5a17b1243eeb07d22985756f5f254c94a55d92d4 Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Tue, 6 Dec 2022 19:16:05 +0100 Subject: [PATCH] fixed background for entry readonly state #643 --- customtkinter/windows/widgets/ctk_entry.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/customtkinter/windows/widgets/ctk_entry.py b/customtkinter/windows/widgets/ctk_entry.py index d6e8ab2..2c52937 100644 --- a/customtkinter/windows/widgets/ctk_entry.py +++ b/customtkinter/windows/widgets/ctk_entry.py @@ -167,6 +167,7 @@ class CTkEntry(CTkBaseClass): outline=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), + readonlybackground=self._apply_appearance_mode(self._bg_color), highlightcolor=self._apply_appearance_mode(self._bg_color)) else: self._canvas.itemconfig("inner_parts", @@ -174,6 +175,7 @@ class CTkEntry(CTkBaseClass): outline=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), + readonlybackground=self._apply_appearance_mode(self._fg_color), highlightcolor=self._apply_appearance_mode(self._fg_color)) 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") 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 """ if funcid is not None: 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) 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._entry.config(fg=self._apply_appearance_mode(self._text_color),