You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Tkinter中单选按钮始终返回None值的问题求助

Tkinter中单选按钮始终返回None值的问题求助

我这段代码里的单选按钮user_ans不知道为啥突然一直返回None了,之前明明能正常获取选中的选项值的,我完全摸不着头脑,也没法回退到之前正常的版本。以下是我的代码片段,麻烦帮忙看看问题出在哪:

from tkinter import *
from tkinter import messagebox
from tkinter.ttk import *
import tkinter
from time import *
import time
import PIL
from PIL import *

#----       ----#
Qright = 0
Qwrong = 0
current_question = 0
pink = 0

def Quizz():
    global pink
    menu.withdraw()
    # define question dictionary
    question = {
        "2+3": ['2', '3', '5', '9'],
        "2-1": ['2', '1', '4'],
        "3+3": ['3', '6', '9', '7'],
        "2+5": ['2', '3', '7', '9'],
        "2-2": ['2', '1', '0'],
        "3+1": ['3', '6', '4', '7'],
        "2+6": ['2', '3', '8', '9'],
        "2-6": ['2', '1', '-4'],
        "3+6": ['3', '6', '9', '7'],
        "3+2...
    # 后续代码未完整粘贴

备注:内容来源于stack exchange,提问作者MW2306RC

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 10:48:00