I am using Python 3.5.0 on Windows 10 and want to replace this:
iconphoto() method in Tkinter | Python iconphoto() method is used to set the titlebar icon of any tkinter/toplevel window. But to set any image as the icon of titlebar, image should be the object of PhotoImage class. Set the titlebar icon for this window based on the named photo images passed through args.
Tkinter relies on Pillow for working with images. Pillow is a fork of the Python Imaging Library, and can be imported in a Python console as PIL. Pillow has the following characteristics: Support for a wide range of image file formats, including PNG, JPEG and GIF.
To use CustomTkinter, just place the /customtkinter folder from this repository next to your program, and then you can do import customtkinter .
To change the icon you should use iconbitmap
or wn_iconbitmap
I'm under the impression that the file you wish to change it to must be an ico file.
import tkinter as tk
root = tk.Tk()
root.iconbitmap("myIcon.ico")
from tkinter import *
app = Tk()
app.title('Tk')
app.geometry('')
app.iconbitmap(r'C:\Users\User\PycharmProjects\HelloWorld\my.ico')
app.mainloop()
pyinstaller --onefile -w -F --add-binary "my.ico;." my.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With