title: how to grab the value from the radiobutton to make a if statement
body: <pre><code>from tkinter import *
  import tkinter.messagebox
  from ProjectHeader import *
  
  
  class Gui(object):
      def __init__(self, parent):
  
          self.gui = parent
  
          self.gui.geometry("350x200")
  
          self.gui.title("Converter")
  
          self.checked1 = IntVar()
          self.checked2 = IntVar()
  
          self.c1 = Radiobutton(self.gui, text='(1)Centimeters', variable=self.checked1, value = 1)
          self.c2 = Radiobutton(self.gui, text='(2)Meter', variable=self.checked1, value = 2)
          self.c3 = Radiobutton(self.gui, text='(3)Millimeters', variable=self.checked1, value = 3)
          self.c4 = Radiobutton(self.gui, text='(4)Kilometers', variable=self.checked1, value = 4)
  
          self.c5 = Radiobutton(self.gui, text='(5)Centimeters', variable=self.checked2, value = 5)
          self.c6 = Radiobutton(self.gui, text='(6)Meter', variable=self.checked2, value = 6)
          self.c7 = Radiobutton(self.gui, text='(7)Millimeters', variable=self.checked2, value = 7)
          self.c8 = Radiobutton(self.gui, text='(8)Kilometers', variable=self.checked2, value = 8)
  
          self.b1 = Button(self.gui, text="Convert", command=self.callback)
          self.l1 = Label(self.gui, text="Value")
          self.l2 = Label(self.gui, text="Convert -&gt;")
          self.e1 = Entry(self.gui, bd = 5)
  
          self.e1.insert(0, "0")
  
          self.c1.pack(side = BOTTOM)
          self.c2.pack(side = BOTTOM)
          self.c3.pack(side = BOTTOM)
          self.c4.pack(side = BOTTOM)
          self.c5.pack(side = BOTTOM)
          self.c6.pack(side = BOTTOM)
          self.c7.pack(side = BOTTOM)
          self.c8.pack(side = BOTTOM)
  
          self.l1.pack(side = TOP)
          self.l2.pack(side = TOP)
          self.e1.pack(side = TOP)
          self.b1.pack(side = TOP)
  
          self.c1.place(x = 3, y = 90)
          self.c2.place(x = 3, y = 110)
          self.c3.place(x = 3, y = 130)
          self.c4.place(x = 3, y = 150)
          self.c5.place(x = 235, y = 90)
          self.c6.place(x = 235, y = 110)
          self.c7.place(x = 235, y = 130)
          self.c8.place(x = 235, y = 150)
  
          self.l2.place(x = 140, y = 110)
  
  
  
      def callback(self):
  
  
          if self.e1.get() == "0":
              messagebox.showinfo("Error", "Please enter a value")
  
          elif self.checked1.get(): #Centiemters
              C = Centimeters(self.e1.get())
              if self.checked2.get():
                  messagebox.showinfo("Error", "Converting the same unit!")
              if self.checked2.get():
                  value = C.ToMeters()
                  messagebox.showinfo("Value", str(value) + ' cm')
              if self.checked2.get():
                  value = C.ToMillimeters()
                  messagebox.showinfo("Value", str(value) + ' cm')
              if self.checked2.get():
                  value = C.ToKilometers()
                  messagebox.showinfo("Value", str(value) + ' cm')
  
  root = Tk()
  
  my_window = Gui(root)
  
  root.mainloop()
  </code></pre>
  
  <p>so now I changed the <code>self.checked1.get() == 1</code> to <code>self.checked1.get()</code>
  because you said by checking on the radiobutton, it would select the option</p>
  
  <p>but now, when I the check the (1)Centimeters button, or either (5)Centimeters to (8)Kilometers button, the program would select all the options</p>
  
  <p>for example, if I checked (1)Centimeters button and (8)Kilometers, the program would pop up not only converted value of Kilometers, but also the converted value of meters, millimeters.</p>
  
  <p>so my question is how can I fix the program that when I checked the 1st box on the left side, and either one of the boxes on the right side, the program would give the correct selection?</p>
  
  <p>Here is the interface of checkedbutton
  <a href="http://postimg.org/image/6uqwkybw5/" rel="nofollow">http://postimg.org/image/6uqwkybw5/</a></p>