Comments (6)
Maybe you can post your full code, and the full error message. Are you on Windows or macOS?
from tkintermapview.
I can't post the full code, but I will post everything I think is relevant:
Function that loads new window and creates and places instance of map (I tried again with your dimensions etc. to make sure it wasn't the way I was constructing the map):
def show_map():
map_window = Tk()
map_window.title('Map View')
map_window.geometry('1920x1080+0+0')
agency_map = TkinterMapView(map_window, width=800, height=600, corner_radius=0)
agency_map.place(relx=0.5, rely=0.5, anchor=CENTER)
(above is indented properly, just can't get the indents to work properly on github)
One line code importing the library (After 'pip install tkintermapview'):
from tkintermapview import TkinterMapView
That's as simple as it gets really, the full error is this:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Jord\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "C:\Users\Jord\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 814, in callit
func(*args)
File "C:\Users\Jord\PycharmProjects\superposer_v0.0.1\venv\lib\site-packages\tkintermapview\map_widget.py", line 361, in update_canvas_tile_images
canvas_tile.set_image(image)
File "C:\Users\Jord\PycharmProjects\superposer_v0.0.1\venv\lib\site-packages\tkintermapview\canvas_tile.py", line 33, in set_image
self.draw(image_update=True)
File "C:\Users\Jord\PycharmProjects\superposer_v0.0.1\venv\lib\site-packages\tkintermapview\canvas_tile.py", line 56, in draw
self.canvas_object = self.map_widget.canvas.create_image(canvas_pos_x,
File "C:\Users\Jord\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2790, in create_image
return self._create('image', args, kw)
File "C:\Users\Jord\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2776, in _create
return self.tk.getint(self.tk.call(
_tkinter.TclError: image "pyimage3" doesn't exist
from tkintermapview.
I cannot reproduce this, maybe you can try it without using a virtual environment. And are you using the latest version 1.1?
Do the example programs from this repository also fail?
from tkintermapview.
Sorry, I deleted your post, because it showed up three times for me, but looks like it was just a ui bug 😅. Anyway your post was:
Hi Tom,
I'll answer your questions first!
I don't think I'm using a virtual environment: I'm using PyCharm in Windows to write to .py files directly on my drives.
I am using TkinterMapView version 1.1.
I've created a test file which just contains the script:
from tkinter import *
from tkinter import ttk
from tkintermapview import TkinterMapView
root = Tk()
root.title('Test')
root.geometry('1220x880+0+0')
agency_map = TkinterMapView(root, width=800, height=600, corner_radius=0)
agency_map.place(relx=0.5, rely=0.5, anchor=CENTER)
root.mainloop()
And it works fine...
Is it possible that importing TkinterMapView has messed with my imports? The test program has three imports (* from tkinter, ttk and TkinterMapView) but since I haven't used 'ttk', it is showing as greyed out in my IDE.
In the real program, however, I have several imports (* from tkinter, ttk, mysql.connector, TkinterMapView and 'form_fields' & 'settings' (two of my own source code files). The key difference I have noticed is that the line 'from tkinter import *' has been greyed out - I think this occurred after importing TkinterMapView.
from tkintermapview.
Hi Tom!
Yeah no worries...
Anyway, I think I may have solved the issue for myself, but not sure why it occurred in the first place.
It's something to do with how images are called on Tkinter windows.
I know this because I fixed the problem by using the Tkinter.Toplevel function to create my top level window, instead of using the Tkinter.TK function.
Perhaps this isn't an issue with the map view and is actually just my lack of understanding of how images and windows work in Tkinter. Feel free to close this issue if that's the case.
Thanks for all your time and support - I'm going to use the **** out of this library! Haha
from tkintermapview.
Okay that's great, yeah a second window should be created with Toplevel instead of Tk, I recently had a situation where also weird things happened by doing this.
from tkintermapview.
Related Issues (20)
- Unable to load overlay layer using "set_overlay_tile_server" HOT 13
- Add Circle with specific radius HOT 1
- 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
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.