【提问】Tkinter中Radiobutton传参的代码
在Entry组件中, validatecommand=(tesCMD, '%P')可以实现自动读取输入用于自定义函数Raiobutton有没有类似的功能? 有,只是小甲鱼课上没讲import tkinter as tk
root = tk.Tk()
v = tk.IntVar()
def buttonback():
print(f"选中结果:{v.get()}")
tk.Radiobutton(root,text = "点我~",variable = v,value = 1,command = buttonback).grid(row = 0,column = 0)
tk.Radiobutton(root,text = "点我!",variable = v,value = 2,command = buttonback).grid(row = 0,column = 1)
:
页:
[1]