tkinter python radio button input get value code example

Example: tkinter radio button get value

def Yobidasi1 ():    def func1 ():        print ("resurt", Radio_Value0.get ())        if Radio_Value0.get () == 0:                print ('Fource Shutdown')                return 0        else:                print ('hibernate')                return 1    base01 = tk.Tk ()    base01.title ("Shutdown Option")    base01.geometry ("400x150")    Radio_Value0 = tk.IntVar ()    Radio_Value0.set (0)    Shutdown_Option = {0: 'Force Shutdown', 1: 'hibernate'}    tk.Label (base01, text = 'Shutdown Option'). pack ()    R_button0 = tk.Radiobutton (base01, text = Shutdown_Option [0], variable = Radio_Value0, value = 0) .pack ()    R_button1 = tk.Radiobutton (base01, text = Shutdown_Option [1], variable = Radio_Value0, value = 1) .pack ()    button4 = tk.Button (base01, text = 'Decision', command = lambda: func1 ()). pack ()