CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

Selected text coloring

Open infiniteTesch opened this issue 11 months ago • 1 comments

Hi!

As the subject expose I am interested in changing the color of the selected text in the CTkTextbox. There is no such variable but maybe someone found a workaround? Otherwise it would be a nice add. Thanks for great contribution with this set of custom tkinter widgets.

Best regards InfiniteTesch

infiniteTesch avatar Feb 28 '24 10:02 infiniteTesch

import customtkinter as ctk

def set_selection_color(ctk_textbox, bg_color, fg_color): ctk_textbox._textbox.tag_configure("sel", background=bg_color, foreground=fg_color)

window = ctk.CTk()

ctk_textbox = ctk.CTkTextbox(window) ctk_textbox.pack()

ctk_textbox.insert("1.0", "Hello, World!") set_selection_color(ctk_textbox, bg_color="red", fg_color="white")

window.mainloop()

:-)

JanPanthera avatar Feb 28 '24 15:02 JanPanthera