img = Image.open(“C:UsersverafDesktopBlog.png”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated UXXXXXXXX escape
My code:
import tkinter as tk
from PIL import Image, ImageTk
def blog():
b.pack_forget() # Hide the button when switching to the frame
<code>frame = tk.Frame(w) # Create a new frame inside the main window
frame.config(bg="blue")
frame.pack(fill='both', expand=True) # Fill the window with the frame
total_rows = 10 # Number of rows
total_columns = 10 # Number of columns
try:
# Load and place image at row 0, column 0
img = Image.open("C:UsersverafDesktopBlog.png")
img = img.resize((50, 50), Image.ANTIALIAS) # Resize the image as needed
img_tk = ImageTk.PhotoImage(img)
</code>
<code>frame = tk.Frame(w) # Create a new frame inside the main window
frame.config(bg="blue")
frame.pack(fill='both', expand=True) # Fill the window with the frame
total_rows = 10 # Number of rows
total_columns = 10 # Number of columns
try:
# Load and place image at row 0, column 0
img = Image.open("C:UsersverafDesktopBlog.png")
img = img.resize((50, 50), Image.ANTIALIAS) # Resize the image as needed
img_tk = ImageTk.PhotoImage(img)
</code>
frame = tk.Frame(w) # Create a new frame inside the main window
frame.config(bg="blue")
frame.pack(fill='both', expand=True) # Fill the window with the frame
total_rows = 10 # Number of rows
total_columns = 10 # Number of columns
try:
# Load and place image at row 0, column 0
img = Image.open("C:UsersverafDesktopBlog.png")
img = img.resize((50, 50), Image.ANTIALIAS) # Resize the image as needed
img_tk = ImageTk.PhotoImage(img)
enter image description here
I am trying to put the image there
New contributor
Frosty_YTPT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.