robertlugg / easygui

easygui for Python
http://easygui.readthedocs.org/en/master/
BSD 3-Clause "New" or "Revised" License
455 stars 114 forks source link

Example box returns error for missing image #145

Closed PythonCoderAS closed 6 years ago

PythonCoderAS commented 6 years ago

I was trying out the demo, but the enterbox with image returned the error below. I think it is caused by missing image.

TclError                                  Traceback (most recent call last)
<ipython-input-39-03b23c4dc440> in <module>()
----> 1 easygui.egdemo()

c:\program files\python36\lib\site-packages\easygui\boxes\demo.py in easygui_demo()
    140         # Execute the chosen demo!
    141         chosen_demo = demos.get_demo(index_chosen_demo)
--> 142         demo_reply = chosen_demo()
    143
    144         # Save the reply

c:\program files\python36\lib\site-packages\easygui\boxes\demo.py in demo_enterbox_image()
    361     image = os.path.join(package_dir, "python_and_check_logo.gif")
    362     message = "What kind of snake is this?"
--> 363     reply = enterbox(message, "Quiz", image=image)
    364     print("Reply was: {!r}".format(reply))
    365     return reply

c:\program files\python36\lib\site-packages\easygui\boxes\derived_boxes.py in enterbox(msg, title, default, strip, image, root)
    348     """
    349     result = __fillablebox(
--> 350         msg, title, default=default, mask=None, image=image, root=root)
    351     if result and strip:
    352         result = result.strip()

c:\program files\python36\lib\site-packages\easygui\boxes\fillable_box.py in __fillablebox(msg, title, default, mask, image, root)
     71         imageFrame = tk.Frame(master=boxRoot)
     72         imageFrame.pack(side=tk.TOP, fill=tk.BOTH)
---> 73         label = tk.Label(imageFrame, image=tk_Image)
     74         label.image = tk_Image  # keep a reference!
     75         label.pack(side=tk.TOP, expand=tk.YES, fill=tk.X, padx='1m', pady='1m')

c:\program files\python36\lib\tkinter\__init__.py in __init__(self, master, cnf, **kw)
   2761
   2762         """
-> 2763         Widget.__init__(self, master, 'label', cnf, kw)
   2764
   2765 class Listbox(Widget, XView, YView):

c:\program files\python36\lib\tkinter\__init__.py in __init__(self, master, widgetName, cnf, kw, extra)
   2294             del cnf[k]
   2295         self.tk.call(
-> 2296             (widgetName, self._w) + extra + self._options(cnf))
   2297         for k, v in classes:
   2298             k.configure(self, v)

TclError: image "pyimage1" doesn't exist
PythonCoderAS commented 6 years ago

I am having error reproducing the error, so maybe it was a one time glitch. Maybe the directory was switched.

zadacka commented 6 years ago

Your analysis of the error sound spot on. I'll close this for now; if the problem becomes reproducible please re-open it and I'll try to re-create and investigate.