嗨有一个有3个选项的盒子。我试图知道选择了哪个项目。有没有办法找出哪个项目被选中并记得?因为,我不希望能够同时选择2个项目。我可以检查每个选项的布尔值吗?我认为,如果' Mils / sec'是真是假......如果点击另一个项目,我可以将其切换为相反。
由于
def func(label): # graph ax2
global milse2a, milse4a, check
if label == 'Distance (mils) Pk-Pk':
if (milse2a == 0):
milse2a = 1
print(check.get_active())
print(check.get())
print(check.state()) #.state() didn't work
#check.state(['selected'])
#print(check.get_active(check.state()))
#if label == 'Distance (m) Pk-Pk''
#check = CheckButtons(rax, ('Mils/sec','Distance (mils) Pk-Pk', 'Distance (m) Pk-Pk'), (True, False, False))
#CheckButt
print('milse2a', milse2a)
else:
milse2a = 0
print('milse2a', milse2a)
if label == 'Distance (m) Pk-Pk':
if (milse2b == 0):
milse2b = 1
print('milse2', milse4a)
else:
milse4a = 0
print('milse2', milse4a)
rax = plt.axes([0.15, 0.62, 0.14, 0.045])
check = CheckButtons(rax, ('Mils/sec','Distance (mils) Pk-Pk', 'Distance (m) Pk-Pk'), (False, False, False))
enter code here