我使用Mapbox GL在地图上显示数据,容器如下所示:
def check_progress(self):
if self.done:
# calculation done, update graph
self.a.clear()
self.a.bar(self.xAxis, self.yAxis)
self.canvas.draw()
# show the graph
self.tkraise()
else:
# calculation not done, schedule next check
self.after(500, self.check_progress)
def real_Graph(self):
self.done = False # set calculation not done
time.sleep(5)
x1 = float(self.controller.shared_data["x1"].get())
x2 = float(self.controller.shared_data["x2"].get())
x3 = float(self.controller.shared_data["x3"].get())
self.xAxis = [float(x1),float(x2),float(x3)]
self.yAxis = [float(x1),float(x2),float(x3)]
self.done = True # set calculation done
def Graph(self):
self.controller.show_frame(WaitingPage)
# create other thread to do calculation
threadGraph = threading.Thread(target=self.real_Graph)
threadGraph.start()
# start the progress check
self.check_progress()
初始化是通过以下代码完成的:
<div id="map" class="mapboxgl-map">
是否存在仅使用元素ID(地图)来获取地图图层/源的方法?