f



bgpic doesn't show background image for turtle

Hello,
I'm trying to have a background image for the turtle graphics.
bgpic("filename.gif") works correctly in terminal mode but I'm
getting an error when it is in a python program :

  File "VisuProg3.0.564.py", line 2206, in afficheLabyrinthe
    bgpic("L1.gif")
  File "<string>", line 8, in bgpic
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/turtle.py", line 1482, in bgpic
    self._setbgpic(self._bgpic, self._bgpics[picname])
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/turtle.py", line 738, in _setbgpic
    self.cv.itemconfig(item, image=image)
  File "<string>", line 1, in itemconfig
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/tkinter/__init__.py", line 2417, in itemconfigure
    return self._configure(('itemconfigure', tagOrId), cnf, kw)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/tkinter/__init__.py", line 1321, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: image "pyimage64" doesn't exist

Regards,

Jean

P.S.

Note that the image file seems to have been corretly located because 
if the file is not there the error message is telling it :

  File "VisuProg3.0.564.py", line 2206, in afficheLabyrinthe
    bgpic("L1.gif")
  File "<string>", line 8, in bgpic
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/turtle.py", line 1481, in bgpic
    self._bgpics[picname] = self._image(picname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/turtle.py", line 479, in _image
    return TK.PhotoImage(file=filename)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/tkinter/__init__.py", line 3393, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/
python3.5/tkinter/__init__.py", line 3349, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't open "L1.gif": no such file or directory


0
Jean
1/19/2016 10:13:53 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

0 Replies
855 Views

Similar Articles

[PageSpeed] 57

Reply: