Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101898

bgpic doesn't show background image for turtle

From Jean Richelle <jean.richelle@ulb.ac.be>
Newsgroups comp.lang.python
Subject bgpic doesn't show background image for turtle
Date 2016-01-19 10:13 +0000
Message-ID <mailman.104.1453198813.15297.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

bgpic doesn't show background image for turtle Jean Richelle <jean.richelle@ulb.ac.be> - 2016-01-19 10:13 +0000

csiph-web