You need to escape the text.
You can do with the re module for example
import re
pl = [re.escape("project name 1"), 'project name 2', 'project name 3']
plstr = ','.join(pl)
strlist = plstr.replace(',', ' ')
print strlist
p = nuke.Panel('Project Name')
p.addEnumerationPulldown('Name: ', strlist)
p.show()
Hi guys,
I'm quite sure somebody answered this before but I cannot find it.
The question is: I'm accessing a DB to get the list of the project names
(some of them have 2 or more words separated by spaces). When creating
the enumerationPulldown every time it finds a space it understand it's a
new entry and split the name of the project in separated entries. Of
course I could replace the space characters with underscores but would
like to know the 'smart' way and place the names with their spaces on it.
I know that if I place the \ character in the options it will use those
characters as break lines, but I have no idea how to use this in a
proper list.
Here you are an example of the code:
pl = ['project name 1', 'project name 2', 'project name 3']
plstr = ','.join(pl)
strlist = plstr.replace(',', ' ')
print strlist
p = nuke.Panel('Project Name')
p.addEnumerationPulldown('Name: ', strlist)
p.show()
What I'm missing here?
Thanks!
Victor Perez
i...@victorperez.co.uk
+44 (0) 7757 199-766
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
--
Magno Borgo
www.boundaryvfx.com
www.borgo.tv
Brasil:Curitiba:GMT= -3
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python