【发布时间】:2022-12-06 19:05:26
【问题描述】:
我这里的问题是,当你点击每个国家时,我想显示一点文本,比如每个国家的首都。现在,我只包括了占位符数字。我尝试使用 str("x") 命令,但没有成功。我在这里做什么?
这是我目前拥有的屏幕截图,在我想要的解决方案中,我希望显示“华盛顿特区”而不是 66。 Here is the image result I am getting
# import pygal library
import pygal
mm = pygal.maps.world.World()
# create a world map
worldmap = pygal.maps.world.World()
# set the title of the map
worldmap.title = 'Countries'
# adding the countries
worldmap.add('Random Data', {
'aq' : 69,
'cd' : 30,
'de' : 40,
'eg' : 50,
'ga' : 45,
'hk' : 23,
'in' : 0,
'jp' : 65,
'nz' : 41,
'kz' : 32,
'us' : 66
})
# save into the file
worldmap.render_to_file('worldmapresult.svg')
open('worldmapresult.svg')
print("Success")
【问题讨论】:
标签: python string integer pygal