Skip to main content

CTkInputDialog

This is a simple dialog to input a string or number.

Example Code

dialog = customtkinter.CTkInputDialog(text="Type in a number:", title="Test")
text = dialog.get_input() # waits for input

Example inside a program:

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.pack(padx=20, pady=20)

app.mainloop()

This example results in the following window and dialog:

CTkInputDialog on Windows 11 example

Arguments

argumentvalue
titlestring for the dialog title
texttext for the dialog itself
fg_colorwindow color, tuple: (light_color, dark_color) or single color
button_fg_colorcolor of buttons, tuple: (light_color, dark_color) or single color
button_hover_colorhover color of buttons, tuple: (light_color, dark_color) or single color
button_text_colortext color of buttons, tuple: (light_color, dark_color) or single color
entry_fg_colorcolor of entry, tuple: (light_color, dark_color) or single color
entry_border_colorborder color of entry, tuple: (light_color, dark_color) or single color
entry_text_colortext color of entry, tuple: (light_color, dark_color) or single color

Methods

  • .get_input()

    Retuns input, waits for 'Ok' or 'Cancel' button to be pressed.