Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何检查Tkinter中是否选择了Radiobutton?_Python_Tkinter - Fatal编程技术网

Python 如何检查Tkinter中是否选择了Radiobutton?

Python 如何检查Tkinter中是否选择了Radiobutton?,python,tkinter,Python,Tkinter,如何检查是否选择了单选按钮?例如,如果选择了r,则执行某些操作如果选择了r1,则执行其他操作已经有一个关于stackoverflow的讨论,您将在那里找到您的答案:以下是链接只有在stackoverflow上不鼓励回答。这个问题已经得到了回答,所以我添加了链接:) from tkinter import * v = IntVar() r = Radiobutton(lf,value=1,variable = v) r1 = Radiobutton(lf,value = 2,variable =

如何检查是否选择了单选按钮?例如,如果选择了r,则执行某些操作如果选择了r1,则执行其他操作

已经有一个关于stackoverflow的讨论,您将在那里找到您的答案:以下是链接

只有在stackoverflow上不鼓励回答。这个问题已经得到了回答,所以我添加了链接:)
from tkinter import *
v = IntVar()
r = Radiobutton(lf,value=1,variable = v)
r1 = Radiobutton(lf,value = 2,variable = v)