[Tutor] Disabling a frame in Tkinter
Hans.Dushanthakumar at navman.com
Fri Jan 6 03:20:55 CET 2006
Yup the code you provided disables all child-widgets:
def setState(self, widget, state='disabled'):
for child in widget.winfo_children():
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf Of John Fouhy
Sent: Friday, 6 January 2006 12:03 p.m.
To: tutor at python.org
Subject: Re: [Tutor] Disabling a frame in Tkinter
On 06/01/06, Hans Dushanthakumar <Hans.Dushanthakumar at navman.com> wrote:
> Is there any way to disable an entire frame (and all its included
> widgets) in Tkinter. It does not seem to support state=DISABLED.
Not that I'm aware of... You could try maybe something like this
def setState(widget, state=DISABLED):
except TclError: # not sure what exception will be raised
for child in widget.children:
> Another Tkinter question: In a listbox, how do I intially set a
> "selected" item? What I want to do here is have the 1st item in a
> listbox selected (ie highlighted) when the appln is run.
Have a look at Fredrik Lundh's Introduction to Tkinter. You can use
.selection_clear() to clear the selection and .selection_set(index) to
select an item. So, .selection_set(0) will select the first item (just
make sure the listbox isn't empty).
Tutor maillist - Tutor at python.org
More information about the Tutor