Hinzufügen eines Hintergrundbilds in python

Ich versuche, fügen Sie ein hintergrund-Bild auf eine Leinwand in Python. So weit der code sieht so aus:

from Tkinter import *
from PIL import ImageTk,Image

... other stuffs

root=Tk()
canvasWidth=600
canvasHeight=400
self.canvas=Canvas(root,width=canvasWidth,height=canvasHeight)
backgroundImage=root.PhotoImage("D:\Documents\Background.png")
backgroundLabel=root.Label(parent,image=backgroundImage)
backgroundLabel.place(x=0,y=0,relWidth=1,relHeight=1)
self.canvas.pack()
root.mainloop()

Es ist die Rückkehr einer AttributeError: PhotoImage

InformationsquelleAutor user1689935 | 2012-11-30

Schreibe einen Kommentar