On 07/01/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
> I don;t have PMW installed. I tend to use Tix now that its part
> of standard Python. However Grayson says this:

Does Tix work with py2exe?  That's why I gave up on it, a while ago..

> So it seems you need
>
> def numeric(val):
>     try: float(val)
>     except ValueError: return Pmw.ERROR
>     else: return Pmw.OK
>
> timeinterval = Pmw.EntryField(.....validate=numeric)

>From memory, you have to do something like
"validate={'validator':numeric}" if you're not using one of the
built-in validators.

(which Asrarahmed would need to do, since he wants to restrict the
range of numbers available)

Also, this will not work quite right; you need something like:

def numeric(val):
    try:
        float(val)
    except ValueError:
        if val == '':
            return Pmw.PARTIAL
        return Pmw.ERROR
    return Pmw.OK

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to