canot get value text when input CTkInputDialog

Author: bobwatcherxCreated Jun 16, 2023Updated Jun 24, 2026
Labelsbugquestion

my code

import tkinter
import customtkinter 

customtkinter.set_appearance_mode("System")
customtkinter.set_default_color_theme("green")

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()

error root@miop-HP-Convertible-x360-11-ab1XX:/home/miop/belajar/custometkinter# python3 main.py Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.10/tkinter/init.py", line 1921, in call return self.func(*args) File "/usr/local/lib/python3.10/dist-packages/customtkinter/windows/widgets/ctk_button.py", line 553, in _clicked self._command() File "/home/miop/belajar/custometkinter/main.py", line 12, in button_click_event dialog = customtkinter.CTkInputDialog(text="Type in a number:", title="Test") File "/usr/local/lib/python3.10/dist-packages/customtkinter/windows/ctk_input_dialog.py", line 50, in init self.grab_set() # make other windows not clickable File "/usr/lib/python3.10/tkinter/init.py", line 941, in grab_set self.tk.call('grab', 'set', self._w) _tkinter.TclError: grab failed: window not viewable

Source: TomSchimansky/CustomTkinter