Open Beatriz910 opened 1 month ago
Make sure the image path is correct.
image_path = './ImageFolder/save.png'
image = Image.open(image_path)
i know ive read the documentation but im a beginner but i tried but it doesnt work
`import customtkinter as ctk from PIL import Image, ImageTk
app = ctk.CTk()
image = Image.open(save.png) photo = ImageTk.PhotoImage(image)
button = ctk.CTkButton(app, image=photo, text="") # Empty text to show only the image button.pack(pady=20, padx=20)
app.mainloop() `
Try it
from PIL import Image
My_image = ctk.CTkImage(light_image=Image.open("image.png"), size=(10, 10))
Button = ctk.CTkButton(app, image=My_image, text="")
Button.pack()
Don't forget the "" in the open() function
you're off to a good start but you forgot the "" here -> image = Image.open(save.png)
i know ive read the documentation but im a beginner but i tried but it doesnt work
`import customtkinter as ctk from PIL import Image, ImageTk
app = ctk.CTk()
image = Image.open(save.png) photo = ImageTk.PhotoImage(image)
button = ctk.CTkButton(app, image=photo, text="") # Empty text to show only the image button.pack(pady=20, padx=20)
app.mainloop() `