Search code examples
pythontkintercustomtkinter

How to make popouts with CTkInput encode


I'm working on password manager and had structure like that:

def popUp(text):
    answer = simpledialocusg.askstring("input string", text)

    return answer

And it works perfectly, but I want to make popouts looks better with Custom Tkinter. When I made

def popUp(text):
    answer = customtkinter.CTkInputDialog("input string", text)

    return answer

I got an error: AttributeError: 'CTkInputDialog' object has no attribute 'encode'

Expect popouts works correctly


Solution

  • You should check the wiki page before opening a question here.

    https://github.com/TomSchimansky/CustomTkinter/wiki/CTkInputDialog

    The syntax should be like this:

    def getInput():
        answer = customtkinter.CTkInputDialog(text = "input string")
        print(answer.get_input())
    
    root = customtkinter.CTk()
    
    button = customtkinter.CTkButton(root, command=getInput)
    button.pack(pady=30, padx=20)
    
    root.mainloop()