Enter key for an entry #239
Valenterie
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
You create a callback function and bind it to the entry like the following: import customtkinter
app = customtkinter.CTk()
def add_element_callback(event):
print("add element:", entry.get())
entry = customtkinter.CTkEntry(app)
entry.pack(pady=20, padx=20)
entry.bind("<Return>", add_element_callback)
app.mainloop() |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone ! I'm currently trying to do a todo list on tkinter and CTk and I'm having an issue :
I want to add an item in my list with the CTkEntry by hitting the enter key, unfortunately, for this to work, I have to be in a "while True:" loop and it's not possible since it would break the rest of my code, here's my code :
What's important is the beginning and the end, the "enter" variable is just if i hit the enter key, but it's not the good solution since it's not looking everytime if i hit the key but only on the first frame when i run the code, is there a solution to make it work ? i searched in "customtkinter_entry.py" and "customtkinter_settings.py" but it seems like there is no other way whatsoever.
Beta Was this translation helpful? Give feedback.
All reactions