newnewbie
newnewbie

Reputation: 1003

put a picture on a label python tkinter

I have found a similar question here, but the answer did not help.

I have a python skript and a .gif

Both are in the same directory. I am trying the following:

 master = Tk()       
 left = PhotoImage(file = "A.gif")

However, I get an "No such file or directory" Exception for the gif.

Where do I put it to avoid this

Upvotes: 0

Views: 120

Answers (1)

Robᵩ
Robᵩ

Reputation: 168876

You mention that the .gif and the .py are in the same directory, but that's not actually relevant.

What is relevant is whether the .gif is in the current working directory of your python process.

Try one of these:

  1. setting your shell's current working directory to the directory that holds the .gif, or
  2. using an absolute path name in the PhotoImage call

Upvotes: 2

Related Questions