[Tutor] Tkinter ... deactivating a Text window when a radiobuttonis chosen

Alan Gauld alan.gauld at btinternet.com
Thu Dec 14 19:00:36 CET 2006

"Patrick Lorenz" <plorenz at mma.edu> wrote in

> I'd appreciate some help.  I am just learning Tkinter, and want to
> deactivate a Text window when a certain radiobutton is selected.  I
> cannot figure it out.

In future its best if you post some code to show what you
are attempting.

Meanwhile this works for me:

from Tkinter import *

t = Tk()
f = Frame(t)
T = Text(f, width=100, height=20)

def doit():
  if T['state'] == DISABLED:
     T['state'] = NORMAL
  else: T['state'] = DISABLED

b = Button(f, text='Toggle state', command = doit)



Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list