-
I want to take the file name from variable called "name" and render the image if it exists. |
Beta Was this translation helpful? Give feedback.
Answered by
Akascape
Oct 27, 2022
Replies: 1 comment 1 reply
-
import os
image_label = customtkinter.CTkButton(app, text = "", fg_color=None, hover=False) # Your image widget
image_label.grid()
name = "image.png" # file name
if os.path.exists(name):
# If the file exists then render it in the widget
image_label.configure(image = ImageTk.PhotoImage(Image.open(name).resize((200, 200), Image.Resampling.LANCZOS))) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Jeymen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Jeymen