Python tkinter Radiobutton solution
import tkinter as tk
my_w=tk.Tk()
my_w.geometry('500x500')
def my_upd():
if(r1_v.get()==1):
c1_v.set(1)
c2_v.set(0)
elif(r1_v.get()==2):
c1_v.set(0)
c2_v.set(1)
r1_v=tk.IntVar() # Decleared Integer variable
r1=tk.Radiobutton(my_w,text='PHP',variable=r1_v,value=1,command=my_upd)
r1.grid(row=1,column=1)
r2=tk.Radiobutton(my_w,text='Python',variable=r1_v,value=2,command=my_upd)
r2.grid(row=1,column=2)
c1_v=tk.IntVar() # Decleared Integer variable
c1=tk.Checkbutton(my_w,text='PHP',variable=c1_v,onvalue=1,offvalue=0)
c1.grid(row=2,column=1)
c2_v=tk.IntVar()
c2=tk.Checkbutton(my_w,text='Python',variable=c2_v,onvalue=1,offvalue=0)
c2.grid(row=2,column=2)
my_w.mainloop()
« Radio button Tutorial & Exercise
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com