Original title: CtkButton doesn’t load images correctly
I have coded a python application for help me manage my works. For do this I need some buttons. I chose to use CustomTkinter because of the visual effect but mostly of the times the icons of the buttons doesn’t load. Here is my code: import customtkinter as ctk from PIL import Image import os from pathlib import Path import tkinter
directory_base = Path.home() / “AppData” / “Local” / “TestApp”
percorso_icone = os.path.join(directory_base,‘Risorse’,‘icone’) img = Image.open(os.path.join(percorso_icone,‘icona_cartelle.png’)) cartella_con_elementi = ctk.CTkImage(light_image=img,dark_image=img,size=(40,40))
immagini = {“cartella_con_elementi”:cartella_con_elementi}
def crea_pulsante(frame, nome, riga, colonna, resto_laterale): global immagini btn = ctk.CTkButton(master=frame,text=nome,compound=‘top’,fg_color=‘white’,text_color=‘black’,corner_radius=6,cursor=‘hand2’,hover=True) btn._text_label.configure(wraplength=150) btn.grid(row=riga, column=colonna, padx=resto_latera