Display an integer property as a percent?

Anyone know how to display an integer property value as a percent? An example in Blender would be under “Dimensions” of the Render tab of the properties panel. The source code seems to be referencing “resolution_percentage” in its property, however I can’t find in Blender where it’s making these changes. If no official solution, anyone know how to rig a percent sign like the one in the Dimensions slider? Thanks.

It is not a display option, but a property of a property:

import bpy


class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout

        layout.prop(context.scene, "my_prop")


def register():
    bpy.utils.register_class(HelloWorldPanel)
    bpy.types.Scene.my_prop = bpy.props.IntProperty(subtype="PERCENTAGE", min=0, max=100)


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


if __name__ == "__main__":
    register()

Excellent. Thanks!

I’m trying to make a panel which will display attributes like intensity and color from the influence section of the texture tab in the properties window. I’m wondering if there’s a way I could import all the items in that section and tag a subtype=“PERCENTAGE” onto them without having to pass the values for every individual attribute in that section over to a new property to be registered and held via the Window Manager. Any ideas?

no, that would mean to re-declare built-in properties, which can cause random crashes. You can let numeric properties show as slider however, layout.prop(…, slider=True). There is no such option for percentage.

Ok. Thanks.