On Tue, Jun 10, 2003 at 02:34:17PM -0700, Shannon -jj Behrens wrote:
> I had to do something similar.  I recommend the following (pseudocode):
> 
> def on_init:
>       old_text = "whatever"
> 
> def on_changed:
>       if not is_valid(new_text):
>               new_text = old_text
>       else:
>               old_text = new_text
> 
> In this way, he can never enter anything into the box that's invalid,
> and his cursor will always be at the end of the entry box waiting to
> type more valid stuff.  
> 

I'm guessing you bind the on_changed() method to the "changed" signal,
but I think at that point the new character has already been added into
the entry box, so are you replacing the text in the entry box every
time?

Art


-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to