TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.8k stars 1.03k forks source link

How to change the icon in CTkInputDialog #2355

Open Yuniek opened 3 months ago

Yuniek commented 3 months ago

I was making my software and just encountered an issue with CTkInputDialog. I wanted my icon on the Input Dialog but there is no such attribute that can help me

JanPanthera commented 3 months ago

https://github.com/TomSchimansky/CustomTkinter/issues/2302#issuecomment-1991632556

Yuniek commented 3 months ago

#2302 (comment)

Bro, can you please convert this code(in which my custom icon can be displayed) and give it?

import customtkinter
app = customtkinter.CTk()
app.geometry("400x300")

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

app.mainloop()
JanPanthera commented 3 months ago

Firstly, I'm not your 'bro,' and secondly, if you can't do it yourself, I recommend learning the basics of programming, googling, and reading documentation. Learning by doing is key. 😹

And, there is also something called ChatGPT, just saying. xD

JanPanthera commented 3 months ago

Since CTkInputDialog inherits from CTkTopLevel, you can modify the icon by accessing the inherited methods from CTkTopLevel.

Furthermore, since CTkTopLevel inherits from tkinter.Toplevel, you can utilize tkinter.Toplevel's functions to change the icon. It's important to note, as referenced in the comment, that there are specific aspects you need to be aware of; otherwise, you might think it doesn't work.