0

我的 mapview 应用程序没有加载图像,我不知道为什么

4

1 回答 1

0
  1. 检查并确保您的互联网连接运行迅速
  2. 确保你有“请求”模块
  3. 试试这个例子,确保你已经安装了所有的 kivy_garden 模块

试试这个代码:

import sys

from kivy.base import runTouchApp
from kivy.lang import Builder

if __name__ == '__main__' and __package__ is None:
    from os import path

    sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))


root = Builder.load_string(
    """
#:import sys sys
#:import MapSource kivy_garden.mapview.MapSource
MapView:
    lat: 50.6394
    lon: 3.057
    zoom: 13
    map_source: MapSource(sys.argv[1], attribution="") if len(sys.argv) > 1 else "osm"

    MapMarkerPopup:
        lat: 50.6394
        lon: 3.057
        popup_size: dp(230), dp(130)

        Bubble:
            BoxLayout:
                orientation: "horizontal"
                padding: "5dp"
                AsyncImage:
                    source: "http://upload.wikimedia.org/wikipedia/commons/9/9d/France-Lille-VieilleBourse-FacadeGrandPlace.jpg"
                    mipmap: True
                Label:
                    text: "[b]Lille[/b]\\n1 154 861 hab\\n5 759 hab./km2"
                    markup: True
                    halign: "center"

"""
)

runTouchApp(root)


于 2021-10-07T03:11:11.750 回答