Comments (16)
I'm working on Windows 10 !
from tkintermapview.
Yeah, it looks like there is a thread running where PhotoImage objects are created even after the window is closed. I will try to catch these errors or stop the thread in time.
from tkintermapview.
The error should be resolved now with version 1.6, if you experience it again, just mention it here...
from tkintermapview.
Thank you greatly for looking into it. :)
from tkintermapview.
I have a new problem ! Even if i download version 1.6 i have this f*cking error again... How do i do ? I'm really confuse because i see many people making apps with this and all of their apps works and mine not working for none reasons !
Anyway, good bye !
Miyu.
from tkintermapview.
Can you post your code or a smaller example where the error appears?
from tkintermapview.
from tkinter import *
from tkinter.ttk import *
from tkinter import ttk
from PIL import *
import tkintermapview
import tkinter
import tkinter.messagebox as mb
def mapsapp():
# create tkinter window
root_tk = tkinter.Tk()
root_tk.geometry(f"{1000}x{700}")
root_tk.title("map_view_simple_example.py")
# create map widget
map_widget = tkintermapview.TkinterMapView(root_tk, width=1000, height=700, corner_radius=0)
map_widget.pack(fill="both", expand=True)
# set other tile server (standard is OpenStreetMap)
# map_widget.set_tile_server("https://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga", max_zoom=22) # google normal
# map_widget.set_tile_server("https://mt0.google.com/vt/lyrs=s&hl=en&x={x}&y={y}&z={z}&s=Ga", max_zoom=22) # google satellite
# set current position and zoom
# map_widget.set_position(52.516268, 13.377695, marker=False) # Berlin, Germany
# map_widget.set_zoom(17)
# set current position with address
# map_widget.set_address("Berlin Germany", marker=False)
def marker_click(marker):
print(f"marker clicked - text: {marker.text} position: {marker.position}")
# set a position marker (also with a custom color and command on click)
marker_2 = map_widget.set_marker(52.516268, 13.377695, text="Brandenburger Tor", command=marker_click)
marker_3 = map_widget.set_marker(52.55, 13.4, text="52.55, 13.4")
# marker_3.set_position(...)
# marker_3.set_text(...)
# marker_3.delete()
# set a path
path_1 = map_widget.set_path([marker_2.position, marker_3.position, (52.568, 13.4), (52.569, 13.35)])
# path_1.add_position(...)
# path_1.remove_position(...)
# path_1.delete()
root_tk.mainloop()
This is my code !
My error is the same that Kromilan !
from tkintermapview.
Which operating system are you working on?
from tkintermapview.
I have tkintermapview on an install on my work laptop and it seems to run fine. However, when I try to get it to work on my private laptop, it keeps throwing this error:
File "***\anaconda3\lib\site-packages\PIL\ImageTk.py", line 118, in del
name = self.__photo.name
AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
EDIT: it seems this error pops up when the .mainloop() command is not active (it was for some reason I can't remember commented in my code)
from tkintermapview.
Same problem in raspberrypi os. It's because lack of Pillow module. Installing pillow >9.0.1 will slove the problem.
from tkintermapview.
I have the same error running it with your map_view_simple_example.py code. I am using mac 12.0.1.
from tkintermapview.
I have this same issue too even after upgrading pillow. It seems to only happen if I don't use the default mainloop like BlaatVogel noted. It works fine when I use mainloop - however my (existing) script is using cefpython3, so I'm running a custom main loop that looks like this:
root.update_idletasks()
root.update()
sleep(5/1000)
cef.MessageLoopWork()
to combine both the tkinter GUI loop with the cef message loop. I think it's possible to have cef run on another thread, but I'll probably be getting rid of it anyways if this map widget works for me, as I was using the integrated browser to display an HTML map file anyways :)
What's relying on the mainloop that's causing an issue with PhotoImage?
from tkintermapview.
It looks like the loop is still running but parts of the PhotoImage class don't exist anymore when the program gets closed. Like if they are garbage collected earlier than the loop, I don't know. I will try to put in some more try except blocks to catch these.
from tkintermapview.
I also gets the same error :-(
from tkintermapview.
I'm getting the same error. I have version 1.29. I'm using Python 3.9 and IDLE on a Windows 10 Pro computer with lots of horsepower and RAM. If there is an error anywhere in my code, this Photoimage class error keeps running. I have to kill the application completely, which means I can't read what my errors are because they continue to scroll off. I managed to take a snapshot of the error message.
AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
Exception ignored in: <function PhotoImage.del at 0x00000154C77141F0>
Traceback (most recent call last):
File "C:\Users....\ImageTk.py", line 118, in del
name = self.__photo.name
I love this package, but it would be nice if the 403 error and this Photoimage error were eliminated.
from tkintermapview.
I just fixed my issue with the previously mentioned AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'. This error continues to scroll indefinitely after any other error is triggered in your code. It scrolls so fast that I cannot read my offending error message in the shell. Even CTRL-C and breakpoints are ignored with this AttributeError. I would have to kill the shell to end the program, and thus lose my error messages.
I fixed the problem as follows: I opened ImageTk.py file in the site-packages\PIL folder and moved the "try" statement up by two rows. This put it in front of the problem line -- #118. Now when I get any other error, the code actually stops after that error instead of continuing infinitely with the AttributeError messages. I have not seen any other errors triggered by this edit. It's not elegant, but it has solved my problem.
from tkintermapview.
Related Issues (20)
- set_path function adding lines to lat_lon list HOT 1
- NOAA Electronic Navigation Chart (ENC) Support HOT 1
- marker cluster
- Using offline tiles
- Coordinate conversion error
- set_overlay_tile_server creates empty views HOT 1
- create polygon with name
- Status code 403 HOT 5
- enhancement: Create path lines with arrow head so we can follow the direction of the path
- map moves on marker clicks
- The app has no map, the app is empty!
- map moves
- attribution inclusion and support for folium maps
- Widget's zoom buttons are hollow
- Virus warning when using PyInstaller
- enhancement: marker name text background
- Elepsoid map projection
- Pacific Cutoff
- Drawing a polygon with one edge along the south pole returns error
- [FR] Add a min_zoom option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tkintermapview.