第14142题 单选题
Python Tkinter图示选中排球点击提交后标签显示内容是什么

有如下Python代码,图示界面(选中“排球”单选框)下点击提交按钮,标签内显示的内容为? 图示

import tkinter as tk
def show_selected_option():
    selection = variable.get()
    p={1:"篮球",2:"排球", 3:"足球"}
    label.config(text=f"最喜欢的运动是 {p[selection]}")
root = tk.Tk()
options = [("篮球", 1), ("排球", 2), ("足球", 3)]
variable = tk.IntVar()
for text, value in options:
    tk.Radiobutton(root, text=text, variable=variable, value=value).pack()
button = tk.Button(root, text="提 交", command=show_selected_option)
label = tk.Label(root, text="最喜欢的运动是什么?")
button.pack()
label.pack()
root.mainloop()
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析