0
$\begingroup$

I'm trying to make a script to change the size of the manipulator, but I get this error from console:

Traceback (most recent call last): File "/addon_widget_size.py", line 30, in draw TypeError: UILayout.prop(): error with argument 1, "data" - Function.data expected a AnyType type, not int

I have very limited skills at coding, so this error says nothing to me.

my code is:

bl_info = {
"name": "WidgetSize",
"author": "Ed-Hernandez",
"version": (1, 0),
"blender": (2, 79, 0),
"location": "View3D > properties-panel",
"description": "fast change witget size",
"warning": "",
"wiki_url": "",
"category": "3D View",
}

import bpy

class WidgetSize(bpy.types.Panel):
    """creates a panel for the addon"""
    bl_label = "Widget Size"
    bl_idname = "WidgetSize"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'

    @classmethod
    def draw(self, context):
        layout = self.layout
        col = layout.column()

        row = col.row()
        row.label(text = "WitgetSize")

        row = col.row()
        row.prop(bpy.context.user_preferences.view.manipulator_size, toggle=True, text = "size")

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

register()
$\endgroup$
1
$\begingroup$

You have to pass the property name as a string as second argument:

row.prop(bpy.context.user_preferences.view, "manipulator_size",
         toggle=True, text="size")
$\endgroup$
  • $\begingroup$ Thanks! it had another error, I gess the @classmethod wasn't needed, but after removing that line it worked fine :) $\endgroup$ – Ed Hernandez Mar 24 '18 at 1:54

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.