TomSchimansky / TkinterMapView

A python Tkinter widget to display tile based maps like OpenStreetMap or Google Satellite Images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancment - Marker rotation via setposition

RodneyWall opened this issue · comments

Hello

Is it possible to add a rotation argument to setposition?

Currently I'm rotating a marker (to represent bearing) by invoking ImageTK.PhotoImage(Image.open(img.png).rotate(int)

I'm using left click event and random.randint as placeholders to trigger the functions.

Example code:

def left_click_event(coordinates_tuple):
print("Left click event with coordinates:", coordinates_tuple)
my_pos.set_position(coordinates_tuple[0], coordinates_tuple[1])
my_pos.change_icon(update_icon())

def update_icon():
global current_path
new_heading = random.randint(0, 360)
marker_img = ImageTk.PhotoImage(Image.open(os.path.join(current_path, "diamond2.png")).rotate(new_heading).resize((60, 60)))
return marker_img

Apologies if I'm going about this in entirely the wrong way. I'm still kinda new at this.