enable/disable widgets with checkbox(TKinter)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jwsacksteder@ramprecision.com

    enable/disable widgets with checkbox(TKinter)

    I want to have a check box that can optionally disable a text input field in
    the same dialog. I am asking the user to input the start and end of a range
    and there needs to be a check box to select all items. When the checkbox
    changes state, I want to ghost-out the input fields.

    A rough approximation of the situation follows.

    class mystuff(Frame):
    def __init__(self,p arent=None):
    Frame.__init__( self,parent)
    self.CheckMode = IntVar()

    self.mode_label = Label(self, text='All Line Items?',
    borderwidth='5' )
    self.mode_box = Checkbutton(sel f,
    width='1',varia ble=self.CheckM ode,command=sel f.FlipState)
    self.input_labe l = Label(self, text='Input Name', borderwidth='5' )
    self.input_box = Entry(self, width='3')

    self.pack()

    def FlipState(self) :
    #This does not work!
    self.input_box. disable()
    print "variable is", self.LineItemMo de.get()

Working...