[pygtk] Mask entry

Danny Milosavljevic danny.milo at gmx.net
Sat Feb 18 03:33:14 WST 2006


Hi,

Am Donnerstag, den 16.02.2006, 18:32 -0200 schrieb Johan Dahlin:
> Before integrating this into kiwi I wanted to share this with the rest of 
> you. I know that quite a few of you has asked for this kind of 
> functionality, it's very useful to make it easier, less error prone
> to enter strings which needs to be of a certain format like
> dates, ip addresses, social security numbers.
> 
> Attached is a mask entry which runs standalone, documented and with a simple 
> example.
> 
> Please note that this is only doing input validation, not checking
> the actual *content*, since that's already solved in another layer in
> kiwi I did not want duplicate that code.

Very nice...

I found a small bug that happens when you launch the program and then
close it again, without typing anything.

Traceback (most recent call last):
  File "masks.py", line 264, in cb
    print 'fields', widget.get_field_text()
  File "masks.py", line 215, in get_field_text
    append_field(fields, field_type, s)
  File "masks.py", line 196, in append_field
    s = int(s)
ValueError: invalid literal for int(): 

But other than that, it's quite useable :)

cheers,
  Danny




More information about the pygtk mailing list