TomSchimansky / TomSchimansky/TkinterMapView
Photo Image Error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 743
- Forks
- 110
- PR merge metrics
- No merged PRs in 30d
Description
Hi. I love this project, but I sometimes receive these errors upon closing a window containing this widget. I experimented a bit, but I couldn't find a pattern for when it happens. It looks like it's trying to update the images and when you close the window right while the update happens, you get this error. But I could be wrong. It was never harmful anyways. It's just a mysterious text in the console, but it causes no problems. Still, I would like to find a way to remove/avoid this error. Can you give me some insight into it?
Exception in thread Thread-1 (pre_cache):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "/home/milan/.local/lib/python3.10/site-packages/tkintermapview/map_widget.py", line 278, in pre_cache
self.request_image(zoom, x, self.pre_cache_position[1] + radius, db_cursor=db_cursor)
File "/home/milan/.local/lib/python3.10/site-packages/tkintermapview/map_widget.py", line 348, in request_image
image_tk = ImageTk.PhotoImage(image)
File "/usr/lib/python3.10/site-packages/PIL/ImageTk.py", line 112, in __init__
self.__photo = tkinter.PhotoImage(**kw)
File "/usr/lib/python3.10/tkinter/__init__.py", line 4093, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/usr/lib/python3.10/tkinter/__init__.py", line 4026, in __init__
master = _get_default_root('create image')
File "/usr/lib/python3.10/tkinter/__init__.py", line 297, in _get_default_root
raise RuntimeError(f"Too early to {what}: no default root window")
RuntimeError: Too early to create image: no default root window
Exception ignored in: <function PhotoImage.__del__ at 0x7fa69afba5f0>
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/PIL/ImageTk.py", line 118, in __del__
name = self.__photo.name
AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tkintermapview/map_widget.py, especially pre_cache and request_image, which appear in the traceback. Reproduce closing a window while image updates run and trace the widget shutdown path. Done means the reported console exceptions no longer occur when the window closes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100