Code: Alles auswählen
APP_TITLE = "JPEG-Hintergrund"
app_win = tk.Tk()
app_win.title(APP_TITLE)
# Erzeugt das Hintegrund PIL-Bildobjekt
pil_background_image = Image.open("Labyrinth.jpg")
# Konvertiert das Hintegrund PIL-Bildobjekt zum Tk-Bildobjekt
app_win.tk_background_image = ImageTk.PhotoImage(pil_background_image)
# Erzeugt das Turtle PIL-Bildobjekt
pil_turtle_image = Image.open("Turtle.jpg")
# Konvertiert das Turtle PIL-Bildobjekt zum Tk-Bildobjekt
app_win.tk_turtle_image = ImageTk.PhotoImage(pil_turtle_image)
# Abmessungen des Hintergrundbildes
width = app_win.tk_background_image.width()
height = app_win.tk_background_image.height()
# Erzeuge Bildfläche für das ablegen des Hintergrundbildes
canvas = tk.Canvas(app_win, width=width, height=height, highlightthickness=0)
canvas.pack()
# Legt das Hintegrundbild auf die Bildfläche
canvas.create_image(0, 0, image=app_win.tk_background_image, anchor='nw',
tag="Hintergrund")
# Lege die Turle auf das Hintergrundbild
canvas.create_image(10, 10, image=app_win.tk_turtle_image, anchor='nw',
tag="Hintergrund")
app_win.mainloop()
Ich hoffe mir kann jmd weiterhelfen.