Skip to content

Commit

Permalink
fix lat & lon
Browse files Browse the repository at this point in the history
  • Loading branch information
winsphinx committed Apr 26, 2024
1 parent c190f98 commit 3336154
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self):
help_text="输入一个 IP 地址。",
)
put_button(
label="点击查看结果",
label="点击查看位置",
onclick=self.update,
)
put_markdown("----")
Expand All @@ -34,8 +34,8 @@ def update(self):
city = data["city"]
country = data["country"]
regionName = data["regionName"]
lon = data["lon"]
lat = data["lat"]
lon = "东经" + str(data["lon"]) if data["lon"] >= 0 else "西经" + str(abs(data["lon"]))
lat = "北纬" + str(data["lat"]) if data["lat"] >= 0 else "南纬" + str(abs(data["lat"]))
put_text(f'IP 地址 {pin["ip"]} 对应的地点是:{country} {regionName} {city},经纬度是:{lon}{lat}。')
else:
put_text("无法获取地点信息。")
Expand Down

0 comments on commit 3336154

Please sign in to comment.