A custom list in a custom panel?

I haven’t found a way to display a custom list or dict inside a custom panel as a drop down menu.

I’ve tried:

self.testDict = {'name':'Testing'}

layout.row.prop(self, 'testDict')
# or:
layout.row.prop(self.testDict, 'name')

but it doesn’t work. Any ideas?


i think you need a tuple for that:
mytuple = ((‘1’,‘1’,‘1’), (‘2’,‘2’,‘2’), … )
… and so on…


this is an extraction from a script i wrote some years ago. that should help you.

import bpy
from bpy.props import EnumProperty

funktionen = (('0','0','0'),
            ('1','Mitte (-((4/(m/g))*(1/10))*x**2+(4/(m/g))*m*x)',
            ('2','Fern (g*x)',
            ('3','Nahe (-g*x+g*m)',

bpy.types.Scene.beziehungs_funktion = EnumProperty(attr='beziehungs_funktion', name='Funktionen', description='', items=funktionen, default='0')
bpy.context.scene['beziehungs_funktion'] = 0

class ObjectButtonsPanel(bpy.types.Panel):
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

class OBJECT_PT_beziehungen(ObjectButtonsPanel):
    bl_label = 'Beziehungen'
    bl_context = 'object'

    def draw_header(self, context):
        layout = self.layout
        layout.label(text='', icon='IPO')

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        layout.prop(scene, 'beziehungs_funktion', text='Funktion')

def register():

def unregister():

if __name__ == "__main__":

problem solved?

where is a custom panel tel me please. I can’t find it ;-(

try to use the python-templates: UI Panel Simple.

after you have run the script it’s placed under the object-tab.