Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing text to the marker_click event #112

Open
rrsc1234 opened this issue Oct 5, 2023 · 0 comments
Open

Passing text to the marker_click event #112

rrsc1234 opened this issue Oct 5, 2023 · 0 comments

Comments

@rrsc1234
Copy link

rrsc1234 commented Oct 5, 2023

Hi. I am going through the following example code mentioned in this repository:

import tkinter
import tkintermapview

# 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)

def marker_click(marker):
    print(f"marker clicked - text: {marker.text}  position: {marker.position}")

marker_2 = map_widget.set_marker(52.516268, 13.377695, text="abcd", command=marker_click) ## With this line marker is plotted on the map with text placed beside the marker location

custom_text = 'abcd'
marker_3 = map_widget.set_marker(52.546268, 13.878695, text="", command=marker_click) ## Here text is not placed besides the marker position

root_tk.mainloop()

With the above code I am able to place marker_2 at the required location but with the text placed besides the marker location.

What I am looking for is that I want to place marker_3 on the map and I want to pass custom_text as argument to marker_click so as to use custom_text inside marker_click function.

Also please let me know is there any possibility to attach a pop-up window with the marker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant