root.focus_get() dont detect if the focus is on custom tkinter entrys .

Author: VermillionDevCreated Nov 10, 2022Updated Jun 24, 2026
Labelsbug
import customtkinter
from tkinter import *


def test(event):
    if root.focus_get() == custom_entry:
        print("custom_entry")
    elif root.focus_get() == ttk_entry:
        print("ttk_entry")


root = customtkinter.CTk()

custom_entry = customtkinter.CTkEntry(root)   #CTkEntry
custom_entry.pack()

ttk_entry = Entry(root)                       #ttk_entry
ttk_entry.pack()

root.bind("<Return>", test)
root.mainloop()

when I click on the ttk entry and press enter it print ----> "ttk_entry"

But when I do the same thing to the customtkinter.CTkEntry it print nothing .

Source: TomSchimansky/CustomTkinter