TomSchimansky / TomSchimansky/TkinterMapView

Passing text to the marker_click event

Open
#112 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
743
Forks
110
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The example's set_marker call and marker_click callback are the relevant entry points; first inspect how the command callback is invoked and how marker text is stored. Clarify the desired callback data and popup behavior, then verify the marker_3 interaction alongside the existing marker_2 example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.