[pygtk] which widget

Robert Park rbpark at exolucere.ca
Fri Dec 3 02:03:00 WST 2010

On Thu, Dec 2, 2010 at 12:16 AM, Leon Bogaert <leon at tim-online.nl> wrote:
> Yeah, but how should I for it to always be on the entries in the ListStore? Because now one can type anything in the combobxEntry. A user could type something, ignore the suggestions and move the focus to another widget. How should I deal with this situations? For example, an on_update handler which checks if the entry in the comboBoxEntry exists in the liststore. If it doesn't exist: remove the entry. But that doesn't seem really user friendly.

Well, your signal handler will know what value the user has typed.
Simply check if that value exists in your liststore, and if it
doesn't, there's any number of things you could do. You could: refocus
the combobox when the user tries to focus away from it, discard any
invalid entry the user has typed, display an error dialog instructing
the user to type something else instead.

You just have to be careful to balance your need to have the input
validated with the users need to not be overly hassled with cumbersome
restrictions on their interaction with the program.


More information about the pygtk mailing list