
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
CTkSuggestions implements a suggestion dropdown for a customtkinter widget
pip install CTkSuggestions
import customtkinter as ctk
from CTkSuggestion import suggestions
example_lst = [
"apple","banana","cherry","date","elderberry","fig","grape",
"honeydew","kiwi","lemon","mango","nectarine","orange",
"papaya","quince","raspberry","strawberry","tangerine",
"ugli fruit","vanilla","watermelon","zucchini"
]
#Setup Ctk window
app = ctk.CTk()
app.title("CTkSuggestions_example")
ctk.set_appearance_mode("Dark")
ctk.set_default_color_theme("blue")
screen_width = app.winfo_screenwidth()
screen_height = app.winfo_screenheight()
#configure window size
window_width = screen_width // 2
window_height = screen_height // 2
app.geometry(f"{window_width}x{window_height}+{screen_width//4}+{screen_height//4}")
#Create entry fields
entry = ctk.CTkEntry(app, placeholder_text="Entry",justify="center", font=("Arial", 32, "bold"))
entry2 = ctk.CTkEntry(app, placeholder_text="Entry2",justify="center", font=("Arial", 32, "bold"))
entry3 = ctk.CTkEntry(app, placeholder_text="Entry3",justify="center", font=("Arial", 32, "bold"))
entry.pack(pady=10)
entry2.pack(pady=10)
entry3.pack(pady=10)
#Bind Suggestions on FocusIn event
entry.bind("<FocusIn>", lambda e: suggestions(app,entry,example_lst))
entry2.bind("<FocusIn>", lambda e: suggestions(app,entry2,example_lst))
entry3.bind("<FocusIn>", lambda e: suggestions(app,entry3,example_lst))
app.mainloop()
Option | Description |
---|---|
Master | CustomTkinter main window |
Widget | Entry widget to bind suggestion |
List | List with potential suggestions |
To use CTkSuggestions in your project, follow these steps:
Bind to entry: Bind the suggestion function to the entry widget, and it should appear automatically when the entry widget is focused.
Run your code: Execute your code.
Focus entry: Klick into the entry and a suggestion table will appear.
Typing: After typing at least 3 letters and a suggestion with change.
List all: You can type "*" to show all entrys from the list will appear.
Confirm entry: Klick the option you search for or press Enter to insert it into the widget.
Note: Parts of the code in this example are from CustomTkinter and CTkListbox
If you find my code helpful and would like to support me, feel free to buy me a Ko-fi. However, if you don't want to, that's okay too!
I'm always open to feedback to improve this project further!
FAQs
CTkSuggestions implements a suggestion dropdown for a customtkinter widget
We found that CTkSuggestions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.