diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-18 11:47:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-18 11:47:37 +0300 |
commit | 063a7f217be43718a69f6cbcfcf322ca71bdeeb0 (patch) | |
tree | b51313f72b471bc8193b1924d6f3c3f764094b85 /doc/python_api/examples/bpy.types.Menu.1.py | |
parent | c4d7bb80f508b123d13581b4189ab7293105d98c (diff) |
python api docs & examples for registrable Menu/Panel/Operator/PropertyGroup classes.
Diffstat (limited to 'doc/python_api/examples/bpy.types.Menu.1.py')
-rw-r--r-- | doc/python_api/examples/bpy.types.Menu.1.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.types.Menu.1.py b/doc/python_api/examples/bpy.types.Menu.1.py new file mode 100644 index 00000000000..fa23e2dcfd3 --- /dev/null +++ b/doc/python_api/examples/bpy.types.Menu.1.py @@ -0,0 +1,37 @@ +""" +Submenus +++++++++ +This menu demonstrates some different functions. +""" +import bpy + + +class SubMenu(bpy.types.Menu): + bl_idname = "OBJECT_MT_select_submenu" + bl_label = "Select" + + def draw(self, context): + layout = self.layout + + layout.operator("object.select_all", text="Select/Deselect All") + layout.operator("object.select_inverse", text="Inverse") + layout.operator("object.select_random", text="Random") + + # access this operator as a submenu + layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...") + + layout.separator() + + # expand each operator option into this menu + layout.operator_enum("object.lamp_add", "type") + + layout.separator() + + # use existing memu + layout.menu("VIEW3D_MT_transform") + + +bpy.utils.register_class(SubMenu) + +# test call to display immediately. +bpy.ops.wm.call_menu(name="OBJECT_MT_select_submenu") |