My question is really simple, by default the button of blender dialog boxes is the "OK" string what if I want to display something else? like "Execute" or "Play"? Something a bit more explanatory than "OK"...

Related : How to call a confirmation dialog box?

enter image description here

example of dialog box (nothing out of the usual)

import bpy

class SimplePropConfirmOperator(bpy.types.Operator):
    bl_idname = "my_category.custom_confirm_dialog"
    bl_label = "Do you really want to do that?"
    bl_options = {'REGISTER', 'INTERNAL'}

    prop1: bpy.props.BoolProperty()
    prop2: bpy.props.BoolProperty()

    def poll(cls, context):
        return True

    def execute(self, context):
        self.report({'INFO'}, "YES!")
        return {'FINISHED'}

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)

    def draw(self, context):
        row = self.layout
        row.prop(self, "prop1", text="Property A")
        row.prop(self, "prop2", text="Property B")

class OBJECT_PT_CustomPanel(bpy.types.Panel):
    bl_label = "My Panel"
    bl_idname = "OBJECT_PT_custom_panel"
    bl_space_type = "VIEW_3D"   
    bl_region_type = "UI"
    bl_category = "Tools"
    bl_context = "objectmode"

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

def register():

def unregister():

if __name__ == "__main__":
  • $\begingroup$ Please share code for how you built this panel so we can see your approach $\endgroup$
    – Psyonic
    Dec 15, 2020 at 5:04

1 Answer 1


Unfortunately this isn't something you have any control over. The window_manager.invoke_props_dialog function is defined in C here, and ultimately uses the wm_block_dialog_create function, which contains this:

uiBut *but = uiDefBut(
        col_block, UI_BTYPE_BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");

As you can see from IFACE_("OK"), the text "OK" for the confirm button is hard-coded in the C source, so there's no way to override it short of rebuilding Blender from source.


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.