0

My code does not work but I want to achieve it.

import bpy

def show_error(self,context): self.report({"ERROR"},message="This is an error")

class HelloWorldPanel(bpy.types.Panel): bl_label = "Hello World Panel" bl_idname = "OBJECT_PT_hello" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "New_TEST"

def draw(self, context):
    layout = self.layout
    layout.prop(context.scene,'new_prop',expand=True)

def register(): bpy.utils.register_class(HelloWorldPanel)

bpy.types.Scene.new_prop = bpy.props.EnumProperty(items=[
                                                        ("OP1","Option 1",""),
                                                        ("OP2","Option 2","")],
                                                        update=show_error
                                                        )



def unregister(): bpy.utils.unregister_class(HelloWorldPanel) del bpy.types.Scene.new_prop

if name == "main": register() ```

Muzammil
  • 828
  • 2
  • 14

0 Answers0