This will add a panel in your Properties Window --> Scene Tab called "Layout Demo", which will enable you to select a track if one exists for the 1st Movie Clip added to your scene.

import bpy
class LayoutDemoPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
scene = context.scene
showProp = False
tracks = None
trackingCam = None
# Only show this property if there is at least 1 movie clip that has trackers
if len( bpy.data.movieclips ) > 0:
mc = bpy.data.movieclips[0] # First movie clip
if 'Camera' in mc.tracking.objects:
trackingCam = mc.tracking.objects['Camera']
tracks = trackingCam.tracks
if len( tracks ) > 0:
showProp = True
if showProp and trackingCam and tracks:
props = context.scene.myprops # Reference property group
row = layout.row()
row.prop_search(props, "tracks", trackingCam, "tracks")
class propsGrp( bpy.types.PropertyGroup ):
''' Property group that contains your tracks custom property '''
tracks = bpy.props.StringProperty()
def register():
bpy.utils.register_module(__name__)
# Add property group to scene to make it persistent and accessible to panel
bpy.types.Scene.myprops = bpy.props.PointerProperty(
type = propsGrp
)
def unregister():
bpy.utils.unregister_module(__name__)
# Remove property group from scene when panel is unregistered
del bpy.types.Scene.props
if __name__ == "__main__":
register()
More about how to use property search.