How do I make my own 'list' in my custom panel like this? enter image description here

I want to be able to acces to chosen value (string) as well...


  • $\begingroup$ Doesn't give me any information on where the list is located or set-up... I suppose they are in files that are not supposed to viewed by the average blender user... $\endgroup$ – Bert VdB Jul 27 '16 at 12:24
  • 2
    $\begingroup$ You have a complete example in the templates that can be found in the text editor : have a look to "ui_previews_dynamic_enum.py". This sample shows this kind of menu filled with the png files of a directory. $\endgroup$ – lemon Jul 27 '16 at 12:41
  • 1
    $\begingroup$ Related: blender.stackexchange.com/questions/57306/… $\endgroup$ – p2or Jul 27 '16 at 12:58

That is an Enum Property, essentially an array of options that have an identifying name, a displayed name, and a description (shown in the tooltip).

For example:

bpy.types.Scene.MyEnum = EnumProperty(
    items = [('one', 'One!', 'The first number'), 
             ('two', 'Two', 'The second number'),
             ('three', 'Three', 'The third number')],
    default = "one",
    description = "Pick a number",
    name = "Numbers")

For the first item, "one" is the identifier, "One!" is the name shown in the interface, and "The first number" is shown in the tooltip.

You would access the chosen option using scene.MyEnum, and set it using scene.MyEnum="two".

To display the enum in the interface and allow the user to change it, use layout.prop(scene, 'MyEnum')

Note: The code snippets here are very helpful :)

  • 1
    $\begingroup$ Thanks for the extraordinary quick and perfect answer Greg! $\endgroup$ – Bert VdB Jul 27 '16 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.