Skip to content

Icons to add in Entry #2400

Answered by rigvedmaanas
ubaid2751 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ubaid2751,

There is no inbuilt option to add icon in entry. But you can create a custom component with label (for icon) and entry.

Example Code

from customtkinter import *
from PIL import Image

class IconEntry(CTkFrame):
    def __init__(self, *args, icon, placeholder_text="", **kwargs):
        super().__init__(*args, **kwargs)
        self.configure(cursor="xterm")
        self.icon = CTkLabel(master=self, text="", image=icon, cursor="xterm")
        self.icon.pack(pady=(5, 5), padx=10, side="left")
        self.entry = CTkEntry(master=self, placeholder_text=placeholder_text, corner_radius=0, border_width=0, fg_color=super().cget("fg_color"))
        self.entry.pack(expand=True, fill=

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ubaid2751
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants