Python pyecharts 是怎么自定义提示框内容?

Python020

Python pyecharts 是怎么自定义提示框内容?,第1张

class pyecharts.options.TooltipOpts

# 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行。

# 字符串模板 模板变量有:

# {a}:系列名。

# {b}:数据名。

# {c}:数据值。

# {@xxx}:数据中名为 'xxx' 的维度的值,如 {@product} 表示名为 'product'` 的维度的值。

# {@[n]}:数据中维度 n 的值,如{@[3]}` 表示维度 3 的值,从 0 开始计数。

# 示例:formatter: '{b}: {@score}'

#

# 回调函数,回调函数格式:

# (params: Object|Array) =>string

# 参数 params 是 formatter 需要的单个数据集。格式如下:

# {

#componentType: 'series',

#// 系列类型

#seriesType: string,

#// 系列在传入的 option.series 中的 index

#seriesIndex: number,

#// 系列名称

#seriesName: string,

#// 数据名,类目名

#name: string,

#// 数据在传入的 data 数组中的 index

#dataIndex: number,

#// 传入的原始数据项

#data: Object,

#// 传入的数据值

#value: number|Array,

#// 数据图形的颜色

#color: string,

# }

formatter: Optional[str] = None,

你的enterbox函数没有return,且msg要转换为int类型。

import easygui as g ,pyautogui,time,os

def enterbox(msg,title):

msg = g.enterbox(msg, title, default='',strip = False,image=None)

return int(msg) # python

a=enterbox(msg = '循环次数',title = '提示框') #弹出提示框 输入循环次数

for a in range(a): #a就是循环的次数

print("q")

import tkinter.messagebox as tm

n = int(input('请输入一个自然数:'))

i = 0

j = 1

info = ''

while True:

i += 1

j += 1

if (i >= n):

break

info += '输出的值是{},{}'.format(i, j) + '\r'  # 语句1

tm.showinfo('消息', info)