Path line color and line width options
I am looking at changing the line thickness and colors of GPS path, but I cannot see the option. Ideally I would like to change the line color with other metrics (e.g. speed, altitude...) , using rainbow or parula chart
Is there any methods to control these line options?
You can change the color of a path by passing a colorattribute to .set_path(). Changing the width is currently not supported, but maybe I will implement this in the future.
I'd also love to see a width argument for set_path. I see you can change the width of a drawn line in canvas_path.draw.
here are the modifications to bring to canvas_path.py to change the line width:
class object constructuor: add a self.path_width:
class CanvasPath:
def __init__(self,
map_widget: "TkinterMapView",
position_list,
color="#3E69CB",
width=9,
command=None,
name=None,
data: any = None):
self.map_widget = map_widget
self.position_list = position_list
self.canvas_line_positions = []
self.deleted = False
self.path_color = color
self.path_width = width
self.command = command
self.canvas_line = None
self.name = name
self.data = data
and change this: line 101
self.canvas_line = self.map_widget.canvas.create_line(self.canvas_line_positions,
width=9, fill=self.path_color,
capstyle=tkinter.ROUND, joinstyle=tkinter.ROUND,
tag="path")
by this:
self.canvas_line = self.map_widget.canvas.create_line(self.canvas_line_positions,
width=self.path_width, fill=self.path_color,
capstyle=tkinter.ROUND, joinstyle=tkinter.ROUND,
tag="path")
I added width attribute now with version 1.17. color attribute was added a while ago.