[Tutor] GUI Buttons
Albert-Jan Roskam
fomcl at yahoo.com
Wed Oct 14 09:42:02 CEST 2009
Hi Alan and Kent,
Thank you for helping me. This is a lot simpler than the solution I had in mind. The button names in my program always start with "button_", so I wanted to use locals() in a list comprehension to compile a list of the buttons. But then I'd still have the names and not the instances.
But when is the configure() method more appropriate to change e.g. the button status?
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before you criticize someone, walk a mile in their shoes, that way
when you do criticize them, you're a mile away and you have their shoes!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- On Tue, 10/13/09, Alan Gauld <alan.gauld at btinternet.com> wrote:
> From: Alan Gauld <alan.gauld at btinternet.com>
> Subject: [Tutor] GUI Buttons
> To: tutor at python.org
> Date: Tuesday, October 13, 2009, 10:06 AM
> Please provide a subject when sending
> mail to the list.
> And please create a new message so it doesn't get lost in
> an old thread...
>
> "Albert-Jan Roskam" <fomcl at yahoo.com>
> wrote in message
>
> > I'm using Tkinter to program my very frist GUI.
> > Each button grays out after it has been used so the
> user knows what next steps to take.
> > Now I want to define a Reset button to 'ungray' all
> buttons (state='normal').
> > How can I programmatically create a list of all
> available buttons?
>
> Just add your buttons to a list when you create them
> Then in your reset method do
>
> for button in ButtonList:
> button['state'] = NORMAL
>
> HTH,
>
>
> -- Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list