title: Conditional disabling of widget
body: <p>In the following code, I have been trying to disable the entry1 widget every time I select 1 in the combobox and disable entry2 when i select 2 in combobox.</p>
  
  <p>this is my code:</p>
  
  <pre><code>from Tkinter import *
  import ttk
  
  def refresh():
      if v.get() == 'A':
          entry1.state(['disabled'])
          entry2.state(['!disabled'])
      elif v.get() == 'B':
          entry2.state(['disabled'])
          entry1.state(['!disabled'])
  
  
  
  
  root = Tk()
  v = StringVar()
  var = StringVar()
  
  entry1 = ttk.Entry (root, textvariable= var)
  entry1.grid(row=2, column=2, sticky=(E,W))
  
  entry2 = ttk.Entry (root, textvariable= var)
  entry2.grid(row=4, column=2, sticky=(E,W))
  
  
  v_list=['A','B']
  v.set(v_list[1])
  v_optionmenu = apply(OptionMenu, (root,v) + tuple(v_list))
  v_optionmenu.grid(column=4,row=11,sticky=(W,E))
  
  var = v
  root.bind('&lt;Return&gt;', lambda e: refresh)
  
  root.mainloop()
  </code></pre>
  
  <p>I wanted to create condition based enabling and disabling of widgets.
  My conditions usually are: </p>
  
  <blockquote>
    <p>selection in combobox
    Selection of radiobutton</p>
  </blockquote>
  
  <p>Please Advice how i can go about it.</p>