mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed entry color when disabled
This commit is contained in:
parent
f18ac0c81a
commit
cf62427f66
@ -6,8 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- complete other theme files
|
- complete other theme files
|
||||||
|
- create grayscale theme file
|
||||||
- change font attribute in wiki
|
- change font attribute in wiki
|
||||||
- add new button attributes to wiki
|
- add new button attributes to wiki
|
||||||
|
|
||||||
- cursor configuring
|
- cursor configuring
|
||||||
- overwrite winfo methods
|
- overwrite winfo methods
|
||||||
|
|
||||||
@ -18,6 +20,7 @@ ToDo:
|
|||||||
- Added CTkTabview
|
- Added CTkTabview
|
||||||
- Added .cget() method to all widgets and windows
|
- Added .cget() method to all widgets and windows
|
||||||
- Added .bind() and .focus() methods to almost all widgets
|
- Added .bind() and .focus() methods to almost all widgets
|
||||||
|
- Added 'anchor' option to CTkButton to position image and text inside the button
|
||||||
- Added 'anchor' option to CTkOptionMenu and 'justify' option to CTkComboBox
|
- Added 'anchor' option to CTkOptionMenu and 'justify' option to CTkComboBox
|
||||||
- Added CTkFont class
|
- Added CTkFont class
|
||||||
- Added CTkImage class to replace PIL.ImageTk.PhotoImage, supports scaling and two images for appearance mode, supports configuring
|
- Added CTkImage class to replace PIL.ImageTk.PhotoImage, supports scaling and two images for appearance mode, supports configuring
|
||||||
|
@ -2,6 +2,11 @@ __version__ = "4.6.3"
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter.filedialog as filedialog
|
||||||
|
from tkinter import Variable, StringVar, IntVar, DoubleVar, BooleanVar
|
||||||
|
from tkinter.constants import *
|
||||||
|
|
||||||
|
_ = filedialog, Variable, StringVar, IntVar, DoubleVar, BooleanVar, CENTER # prevent IDE from removing unused imports
|
||||||
|
|
||||||
# import manager classes
|
# import manager classes
|
||||||
from .windows.widgets.appearance_mode.appearance_mode_tracker import AppearanceModeTracker
|
from .windows.widgets.appearance_mode.appearance_mode_tracker import AppearanceModeTracker
|
||||||
|
@ -163,28 +163,28 @@ class CTkEntry(CTkBaseClass):
|
|||||||
fill=self._apply_appearance_mode(self._bg_color),
|
fill=self._apply_appearance_mode(self._bg_color),
|
||||||
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),
|
||||||
fg=self._apply_appearance_mode(self._text_color),
|
|
||||||
disabledbackground=self._apply_appearance_mode(self._bg_color),
|
disabledbackground=self._apply_appearance_mode(self._bg_color),
|
||||||
disabledforeground=self._apply_appearance_mode(self._text_color),
|
highlightcolor=self._apply_appearance_mode(self._bg_color))
|
||||||
highlightcolor=self._apply_appearance_mode(self._bg_color),
|
|
||||||
insertbackground=self._apply_appearance_mode(self._text_color))
|
|
||||||
else:
|
else:
|
||||||
self._canvas.itemconfig("inner_parts",
|
self._canvas.itemconfig("inner_parts",
|
||||||
fill=self._apply_appearance_mode(self._fg_color),
|
fill=self._apply_appearance_mode(self._fg_color),
|
||||||
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),
|
||||||
fg=self._apply_appearance_mode(self._text_color),
|
|
||||||
disabledbackground=self._apply_appearance_mode(self._fg_color),
|
disabledbackground=self._apply_appearance_mode(self._fg_color),
|
||||||
disabledforeground=self._apply_appearance_mode(self._text_color),
|
highlightcolor=self._apply_appearance_mode(self._fg_color))
|
||||||
highlightcolor=self._apply_appearance_mode(self._fg_color),
|
|
||||||
insertbackground=self._apply_appearance_mode(self._text_color))
|
|
||||||
|
|
||||||
self._canvas.itemconfig("border_parts",
|
self._canvas.itemconfig("border_parts",
|
||||||
fill=self._apply_appearance_mode(self._border_color),
|
fill=self._apply_appearance_mode(self._border_color),
|
||||||
outline=self._apply_appearance_mode(self._border_color))
|
outline=self._apply_appearance_mode(self._border_color))
|
||||||
|
|
||||||
if self._placeholder_text_active:
|
if self._placeholder_text_active:
|
||||||
self._entry.config(fg=self._apply_appearance_mode(self._placeholder_text_color))
|
self._entry.config(fg=self._apply_appearance_mode(self._placeholder_text_color),
|
||||||
|
disabledforeground=self._apply_appearance_mode(self._placeholder_text_color),
|
||||||
|
insertbackground=self._apply_appearance_mode(self._placeholder_text_color))
|
||||||
|
else:
|
||||||
|
self._entry.config(fg=self._apply_appearance_mode(self._text_color),
|
||||||
|
disabledforeground=self._apply_appearance_mode(self._text_color),
|
||||||
|
insertbackground=self._apply_appearance_mode(self._text_color))
|
||||||
|
|
||||||
def configure(self, require_redraw=False, **kwargs):
|
def configure(self, require_redraw=False, **kwargs):
|
||||||
if "state" in kwargs:
|
if "state" in kwargs:
|
||||||
@ -289,7 +289,9 @@ class CTkEntry(CTkBaseClass):
|
|||||||
self._placeholder_text_active = True
|
self._placeholder_text_active = True
|
||||||
|
|
||||||
self._pre_placeholder_arguments = {"show": self._entry.cget("show")}
|
self._pre_placeholder_arguments = {"show": self._entry.cget("show")}
|
||||||
self._entry.config(fg=self._apply_appearance_mode(self._placeholder_text_color), show="")
|
self._entry.config(fg=self._apply_appearance_mode(self._placeholder_text_color),
|
||||||
|
disabledforeground=self._apply_appearance_mode(self._placeholder_text_color),
|
||||||
|
show="")
|
||||||
self._entry.delete(0, tkinter.END)
|
self._entry.delete(0, tkinter.END)
|
||||||
self._entry.insert(0, self._placeholder_text)
|
self._entry.insert(0, self._placeholder_text)
|
||||||
|
|
||||||
@ -297,7 +299,8 @@ class CTkEntry(CTkBaseClass):
|
|||||||
if self._placeholder_text_active:
|
if self._placeholder_text_active:
|
||||||
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),
|
||||||
|
disabledforeground=self._apply_appearance_mode(self._text_color),)
|
||||||
self._entry.delete(0, tkinter.END)
|
self._entry.delete(0, tkinter.END)
|
||||||
for argument, value in self._pre_placeholder_arguments.items():
|
for argument, value in self._pre_placeholder_arguments.items():
|
||||||
self._entry[argument] = value
|
self._entry[argument] = value
|
||||||
|
@ -110,11 +110,11 @@ class TestApp(customtkinter.CTk):
|
|||||||
self.frame_3.place(relx=0.5, y=y + 80, anchor=tkinter.CENTER)
|
self.frame_3.place(relx=0.5, y=y + 80, anchor=tkinter.CENTER)
|
||||||
self.frame_3.configure(fg_color=("#EBECF3", "#4B577E"))
|
self.frame_3.configure(fg_color=("#EBECF3", "#4B577E"))
|
||||||
|
|
||||||
self.button_3 = customtkinter.CTkButton(master=self.ctk_frame_customized, command=lambda: x, border_width=3,
|
self.button_3 = customtkinter.CTkButton(master=self.ctk_frame_customized, command=lambda: None, border_width=3,
|
||||||
corner_radius=20, font=("times", 16))
|
corner_radius=20, font=("times", 16))
|
||||||
self.button_3.place(relx=0.5, y=y + 160, anchor=tkinter.CENTER)
|
self.button_3.place(relx=0.5, y=y + 160, anchor=tkinter.CENTER)
|
||||||
self.button_3.configure(border_color=("#4F90F8", "#6FADF9"), hover_color=("#3A65E8", "#4376EE"))
|
self.button_3.configure(border_color=("#4F90F8", "#6FADF9"), hover_color=("#3A65E8", "#4376EE"))
|
||||||
self.button_3.configure(fg_color=None)
|
self.button_3.configure(fg_color="transparent")
|
||||||
|
|
||||||
self.entry_3 = customtkinter.CTkEntry(master=self.ctk_frame_customized, font=("times", 16))
|
self.entry_3 = customtkinter.CTkEntry(master=self.ctk_frame_customized, font=("times", 16))
|
||||||
self.entry_3.place(relx=0.5, y=y + 240, anchor=tkinter.CENTER)
|
self.entry_3.place(relx=0.5, y=y + 240, anchor=tkinter.CENTER)
|
||||||
@ -152,7 +152,7 @@ class TestApp(customtkinter.CTk):
|
|||||||
self.button_4 = customtkinter.CTkButton(master=self.tk_frame_customized, command=lambda: x, border_width=3)
|
self.button_4 = customtkinter.CTkButton(master=self.tk_frame_customized, command=lambda: x, border_width=3)
|
||||||
self.button_4.place(relx=0.5, y=y + 160, anchor=tkinter.CENTER)
|
self.button_4.place(relx=0.5, y=y + 160, anchor=tkinter.CENTER)
|
||||||
self.button_4.configure(border_color=("#4F90F8", "#6FADF9"), hover_color=("#3A65E8", "#4376EE"))
|
self.button_4.configure(border_color=("#4F90F8", "#6FADF9"), hover_color=("#3A65E8", "#4376EE"))
|
||||||
self.button_4.configure(fg_color=None)
|
self.button_4.configure(fg_color="transparent")
|
||||||
|
|
||||||
self.entry_4 = customtkinter.CTkEntry(master=self.tk_frame_customized)
|
self.entry_4 = customtkinter.CTkEntry(master=self.tk_frame_customized)
|
||||||
self.entry_4.place(relx=0.5, y=y + 240, anchor=tkinter.CENTER)
|
self.entry_4.place(relx=0.5, y=y + 240, anchor=tkinter.CENTER)
|
||||||
|
@ -15,14 +15,21 @@ def change_mode():
|
|||||||
customtkinter.set_appearance_mode("dark")
|
customtkinter.set_appearance_mode("dark")
|
||||||
|
|
||||||
|
|
||||||
def button_click_event():
|
def button_1_click_event():
|
||||||
dialog = customtkinter.CTkInputDialog(master=None, text="Type in a number:", title="Test")
|
dialog = customtkinter.CTkInputDialog(text="Type in a number:", title="Test")
|
||||||
print("Number:", dialog.get_input())
|
print("Number:", dialog.get_input())
|
||||||
|
|
||||||
|
|
||||||
button = customtkinter.CTkButton(app, text="Open Dialog", command=button_click_event)
|
def button_2_click_event():
|
||||||
button.place(relx=0.5, rely=0.5, anchor=customtkinter.CENTER)
|
dialog = customtkinter.CTkInputDialog(text="long text "*100, title="Test")
|
||||||
|
print("Number:", dialog.get_input())
|
||||||
|
|
||||||
|
|
||||||
|
button_1 = customtkinter.CTkButton(app, text="Open Dialog", command=button_1_click_event)
|
||||||
|
button_1.pack(pady=20)
|
||||||
|
button_2 = customtkinter.CTkButton(app, text="Open Dialog", command=button_2_click_event)
|
||||||
|
button_2.pack(pady=20)
|
||||||
c1 = customtkinter.CTkCheckBox(app, text="dark mode", command=change_mode)
|
c1 = customtkinter.CTkCheckBox(app, text="dark mode", command=change_mode)
|
||||||
c1.place(relx=0.5, rely=0.8, anchor=customtkinter.CENTER)
|
c1.pack(pady=20)
|
||||||
|
|
||||||
app.mainloop()
|
app.mainloop()
|
||||||
|
@ -7,17 +7,17 @@ app.title("test_vertical_widgets")
|
|||||||
app.grid_columnconfigure(0, weight=1)
|
app.grid_columnconfigure(0, weight=1)
|
||||||
app.grid_rowconfigure((0, 1, 2, 3), weight=1)
|
app.grid_rowconfigure((0, 1, 2, 3), weight=1)
|
||||||
|
|
||||||
progressbar_1 = customtkinter.CTkProgressBar(app, orient="horizontal")
|
progressbar_1 = customtkinter.CTkProgressBar(app, orientation="horizontal")
|
||||||
progressbar_1.grid(row=0, column=0, pady=20, padx=20)
|
progressbar_1.grid(row=0, column=0, pady=20, padx=20)
|
||||||
|
|
||||||
progressbar_2 = customtkinter.CTkProgressBar(app, orient="vertical")
|
progressbar_2 = customtkinter.CTkProgressBar(app, orientation="vertical")
|
||||||
progressbar_2.grid(row=1, column=0, pady=20, padx=20)
|
progressbar_2.grid(row=1, column=0, pady=20, padx=20)
|
||||||
|
|
||||||
slider_1 = customtkinter.CTkSlider(app, orient="horizontal", command=progressbar_1.set,
|
slider_1 = customtkinter.CTkSlider(app, orientation="horizontal", command=progressbar_1.set,
|
||||||
button_corner_radius=3, button_length=20)
|
button_corner_radius=3, button_length=20)
|
||||||
slider_1.grid(row=2, column=0, pady=20, padx=20)
|
slider_1.grid(row=2, column=0, pady=20, padx=20)
|
||||||
|
|
||||||
slider_2 = customtkinter.CTkSlider(app, orient="vertical", command=progressbar_2.set,
|
slider_2 = customtkinter.CTkSlider(app, orientation="vertical", command=progressbar_2.set,
|
||||||
button_corner_radius=3, button_length=20)
|
button_corner_radius=3, button_length=20)
|
||||||
slider_2.grid(row=3, column=0, pady=20, padx=20)
|
slider_2.grid(row=3, column=0, pady=20, padx=20)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user