0

I have written two scripts in python. When I run the two scripts as individual programs they run correctly. But when the second script is run as a module within the first by importing it, an image file is not recognised. I have tried calling the full pathwayof the image without any success.

I have shown the error message below.

Can somebody please help?

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "F:\Python26\WebSite_231109_Pg01_01.pyw.py", line 114, in Import
import WebSite_231109_Pg02_01
File "D:\Python26\WebSite_231109_Pg02_01.py", line 184, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 2156, in create_image
return self._create('image', args, kw)
File "C:\Python26\lib\lib-tk\Tkinter.py", line 2147, in _create
*(args + self._options(cnf, kw))))
TclError: image "pyimage2" doesn't exist

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by vegaseat
0

I assume that pyimage2 is an image object in your module.

Without knowing your code, all I can tell you is that Tkinter will garbage collect any image object assigned to a function scope variable. Maybe it will also do that to a module scope variable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.