Code to show image is giving a syntax error when I use the Address to the image.
from tkinter import *
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
Scare = Tk()
Scare.title('?????')
Countdown = 2
CountTotal = 2
CountTotal = IntVar()
def CountdownWork():
global Countdown
if Countdown > 0:
Countdown = Countdown -1
CountTotal.set(Countdown)
Scare.after(1000, CountdownWork)
else:
ImageAddress = 'C:\Users\KINSLED\Desktop\New folder\ScareTest.jpg'
ImageItself = Image.open(ImageAddress)
ImageNumpyFormat = np.asarray(ImageItself)
plt.imshow(ImageNumpyFormat)
plt.draw()
plt.pause(5) # pause how many seconds
plt.close()
Count = Label(Scare, font=('arial', 10, 'bold'), textvariable=CountTotal,
bd=30, bg='SeaGreen1', justify='right').grid(row=7,columnspan=8)
CountdownWork()
Scare.mainloop()
The Syntax Error is highlighting the space just after the equals in ImageAdress.
The Error is:
(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated\UXXXXXXXX escape