TkinterMapView icon indicating copy to clipboard operation
TkinterMapView copied to clipboard

problem in an async tkinter app 'PhotoImage' object has no attribute '_PhotoImage__photo'

Open alireza787b opened this issue 2 years ago • 7 comments

I exactly followed your example codes but not working inside my async Tkinter app... you example files works fine but don't working inside my app... is there a compatibility problem with async_tkinter_loop?

This is how I add your widget just after my other widgets map_widget = tkintermapview.TkinterMapView(root, width=200, height=200, corner_radius=0) map_widget.pack() map_widget.set_position(48.860381, 2.338594) # Paris, France map_widget.set_zoom(15)

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo' Exception ignored in: <function PhotoImage.del at 0x7f831923b0e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/ImageTk.py", line 146, in del name = self.__photo.name AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'

alireza787b avatar Jul 31 '22 11:07 alireza787b

Can you post a full example? I have never used async with tkinter and I don't know what you are doing...

TomSchimansky avatar Jul 31 '22 16:07 TomSchimansky

Can you post a complete example? I have never used async with Tkinter and I don't know what you are doing...

This might not be the best optimum code, actually my first python experience :) But this program completely works OK. Only mapview doesn't work as expected.

I attached the code... gc1.py.zip

alireza787b avatar Jul 31 '22 17:07 alireza787b

any update on this issue? I still have this problem

alireza787b avatar Sep 14 '22 04:09 alireza787b

I have the same problem

abionics avatar Sep 17 '22 16:09 abionics

This was happening to me every time I close the tkinter window with just the example code from the README, no async involved, but it was fixed once i wrapped the "root_tk.mainloop()" call in the "if name == 'main'" structure. I think there are some async elements in the backend of this library that get detached from the main thread if you close the window or if you have other async elements in your program, so try messing around with the thread management in your code to see if this gets resolved.

wchupp avatar Nov 01 '22 15:11 wchupp

I had this problem when there was time consuming code between root_tk = tkinter.Tk() and root_tk.mainloop(). I was able to solve it by relocating the time consuming code.

Asw1n avatar Jun 02 '23 13:06 Asw1n