Home > Net >  How to make popouts with CTkInput encode
How to make popouts with CTkInput encode

Time:12-05

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

CodePudding user response:

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