Ok, thanks. This example works.

I tried to put it to use in my case, and failed though :(

The pulldown should basically be a copy of the format list in the nuke script 
settings:
This is what it got:

allformats = nuke.formats()
allformatlist = []
for i in allformats:
        allformatlist.append(i.name())
print allformatlist
p = nuke.Panel("Please select Input and Output Resolution")
p.addEnumerationPulldown("Input Format",allformatlist)
p.addEnumerationPulldown("Output Format",allformatlist)
p.show()
inputvalue = p.value('Input Format')
inputindex = allformatlist.index(inputvalue)
print inputvalue
print inputindex

My resulting allformatlist has quotes before and after each format name. 
Therefore i cannot find the index using allformats.index() (or 
allformatlist.index() for that matter)

Daniel


> Am 24.10.2016 um 16:46 schrieb Erik Johansson <e...@goodbyekansas.se>:
> 
> p = nuke.Panel("Please select Input and Output Resolution")
> vals = ['format1', 'format2', 'format3']
> p.addEnumerationPulldown('Input Format', ' '.join(vals))
> p.show()
> val =  p.value('Input Format')
> index = vals.index(val)
> print index
> 
> On Mon, Oct 24, 2016 at 4:33 PM, Daniel Hartlehnert <dah...@gmx.de 
> <mailto:dah...@gmx.de>> wrote:
> Hi,
> 
> i created a nuke panel and added an enumeration pulldown:
> 
> p = nuke.Panel("Please select Input and Output Resolution")
>     p.addEnumerationPulldown("Input Format“,format1 format2 format3)
> 
> Now i want to know which index was selected by the user. If i use:
> 
> p.value(‚Input Format‘)
> 
> i only get the text of the entry that was selected, but not the index.
> I tried getValue, getIndex, index, but nothing worked.
> 
> 
> Daniel
>  _______________________________________________
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk 
> <mailto:Nuke-users@support.thefoundry.co.uk>, http://forums.thefoundry.co.uk/ 
> <http://forums.thefoundry.co.uk/>
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users 
> <http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users>
> 
> 
> 
> -- 
> Erik Johansson
> Pipeline TD
> 
> Goodbye Kansas / Fido / Bläck
> Rosenlundsgatan 40
> 118 53 Stockholm, Sweden
> www.goodbyekansas.se 
> <http://www.goodbyekansas.se/>_______________________________________________
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to