Changing state of buttons.

Brian Szmyd szmyd at colostate.edu
Thu Sep 9 23:21:39 EDT 2004


Jamey Saunders wrote:

> Hi all,
> 
> I'm just learning Python (I'm about 8 hours in so far), and I have a
> problem.  I'm writing a small Windows app using Tkinter.  I have two
> buttons on my screen that I want to start in an inactive state
> (already have that working) and when two input fields have some data
> input, the buttons would become active.  What's the best way to go
> about changing the state of buttons that already exist?
> 
> Thanks!

Hi Jamey,

First off, many people will agree when I say ditch Tkinter, and switch to
wxPython. Never the less...

Not knowing a lot of Tkinter I would guess you can initialize these buttons
to be in the "greyed out" state, and create an event on the two input
fields that checks for any data input. Make the event call some validation
function if you need it, and change the state of the button to "non-greyed
out" if all is well!

-regards
brian szmyd



More information about the Python-list mailing list