Message File Name
Syntax Error
(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: >truncated \UXXXXXXXX escape C:\visualexample.py
I've Imported PIL and tkinter, and tried a few different things, but the one I see mostly suggested is:
img = ImageTk.PhotoImage(Image.open("C:\testpic.gif"))
or
img = tk.PhotoImage(Image.open("C:\testpic.gif"))
Have also tried image file types: .bmp .jpeg .png .gif....put them into a label and pack or place.
I have also got another error msg that I don't have at hand, but it was something like:
Invaild '____str____' value type: 'JpegImageFormat' is not a recognised format.
When this one comes up, it also does it for all picture file types.
I think i'm just going to have to pretty up my program with plain old solid colour backgrounds and font colours. Maybe the PIL Lib is the wrong one (I had to get it separate from python 3.3), I thought I got the right one.
Maybe theres a file size(Mb's) limit?
If anyone has any suggestions as to how to put a picture file in the background that would be great!
edit: python 3x, import tkinter and from PIL import ImageTk, Image
suggestion worked for .gif .bmp .png .jpg :)
img = PIL.ImageTk.PhotoImage(PIL.Image.open(picfilepath))