cheers everybody, I will stick why my getInput, it is more simple
thx for the brainstorm

Hugo Léveillé wrote:
Pyside will also do that. Won't let the user enter anything but numbers it you want. But it might be an overkill learning curve if you only need it for this case. On Tue, May 15, 2012, at 11:57, Nathan Rusch wrote:
You could do it with a PythonPanel containing an Int_Knob, but that may be a little heavy for a simple case like this. I would probably just wrap the nuke.getInput call to validate the string as a number and cast it on return. import re
def getNumericInput():
    while True:
        raw = nuke.getInput('Enter a number:')
        if raw is None:
            return
        if re.match('^\d+$', raw):
            return int(raw)
        nuke.message('Not a valid number')
Obviously this only handles ints, but if you need a float, you can massage the regex a little. Hope this helps. -Nathan From: Ron Ganbar <mailto:[email protected]>
Sent: Tuesday, May 15, 2012 11:48 AM
To: Nuke Python discussion <mailto:[email protected]>
Subject: Re: [Nuke-python] query a number from the user
Well, I wasn't in front of the computer before, and seems like there isn't a number only knob to inherit for the panel object.
I tried this:
p = nuke.Panel( 'how many dudes?' )
p.addExpressionInput('dudes', '')
p.show()
result = p.value('dudes')
print p.value('dudes')
And it works, but you can type anything in there. Not just a number.
Anybody knows a knob that only expects numbers?

Ron Ganbar
email: [email protected] <mailto:[email protected]>
tel: +44 (0)7968 007 309 [UK]
     +972 (0)54 255 9765 [Israel]
url: http://ronganbar.wordpress.com/



On 15 May 2012 20:27, Ron Ganbar <[email protected] <mailto:[email protected]>> wrote:

    You can use a panel and create a knob that only permits numbers.

    R

    On May 15, 2012 6:20 PM, <[email protected]
    <mailto:[email protected]>> wrote:

        Hiya.
        I Am looking for the way the get a pop up window asking me a
        value.
        I cheated by using
        val = int(nuke.getInput('enter the ref frame'))

        wich is normally a text box
        is there a better way for numbers ? I mean that will warn if
        something else than a number is entered

        cheers
        Olivier
        _______________________________________________
        Nuke-python mailing list
        [email protected]
        <mailto:[email protected]>,
        http://forums.thefoundry.co.uk/
        http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_________________________________________________
Nuke-python mailing list
[email protected] <mailto:[email protected]>, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
--
Hugo Léveillé
TD Compositing, Vision Globale
[email protected] <mailto:[email protected]>
------------------------------------------------------------------------

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to