-
Notifications
You must be signed in to change notification settings - Fork 1.1k
CTkInputDialog
Tom Schimansky edited this page Nov 10, 2022
·
2 revisions
This is a simple dialog to input a string or number.
import customtkinter
import tkinter
customtkinter.set_appearance_mode("dark")
app = customtkinter.CTk()
app.geometry("400x300")
def button_click_event():
dialog = customtkinter.CTkInputDialog(text="Type in a number:", title="Test")
print("Number:", dialog.get_input())
button = customtkinter.CTkButton(app, text="Open Dialog", command=button_click_event)
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
app.mainloop()
This example code results in the following window and dialog:
argument | value |
---|---|
title | string for the dialog title |
text | text for the dialog itself |
fg_color | window color, tuple: (light_color, dark_color) or single color |
button_fg_color | color of buttons, tuple: (light_color, dark_color) or single color |
button_hover_color | hover color of buttons, tuple: (light_color, dark_color) or single color |
button_text_color | text color of buttons, tuple: (light_color, dark_color) or single color |
entry_fg_color | color of entry, tuple: (light_color, dark_color) or single color |
entry_border_color | border color of entry, tuple: (light_color, dark_color) or single color |
entry_text_color | text color of entry, tuple: (light_color, dark_color) or single color |
input_value = dialog.get_input() # opens the dialog
CustomTkinter by Tom Schimansky 2022
The Github Wiki is outdated, the new documentation can be found at: