Creating pop-up panels with user UI in Blender add-on

In addition to common panels (N/T/Properties) and their sub-panels, to display the user interface elements while developing Blender add-ons you can also use pop-up panels appearing on the screen when a user presses a certain key combination or perform any action. The simplest example of such panels is the panel that appears when the f6 key is pressed immediately after adding an object (shift+a) to the scene.

Blender API provides developers the ability to create such panels for their add-ons. Let’s consider the creating of a pop-up panel as an example of the “Message box” window.

Unlike basic panels that have their own ancestor class bpy.types.Panel, the pop-up panel is essentially an operator accessing certain Blender window manager functions so it is inherited from the standard bpy.types.Operator class.

Let’s open the favorite code editor, create a basic body for the MessageBox class with the unique identifier “message.messagebox”, and also register this class in the Blender API.

To create a pop-up window we need to call the required function from the Blender window manager. Redefine the interactive function “invoke” of the operator to call the desired window manager function:

The function “invoke_props_dialog” creates the pop-up window what we need. In the function input parameters, we can specify the desired window sizes through the “width” and “height”. The first function parameter is a pointer to our current MessageBox (self) operator.

Depending on the type of the operator transferred to it, the function can return different values:

  • RUNNING_MODAL – modal start
  • CANCELED – cancel
  • FINISHED – normal completion
  • PASS_THROUGH – empty start (nothing done)

In general, FINISHED will be returned by clicking the “OK  button and CANCELLED – by closing the window (pressing Esc or clicking outside window area).

If “invoke” returns FINISHED, our MessageBox operator runs the “execute” function. Redefine it to print the message to the status output and system console:

The code of the MessageBox operator:

To test it, we can create a button (in the special part of the T-panel) executes our MessageBox operator, showing the “Sample Text” message:

Just calling the “invoke_props_dialog” function, only the base window with an empty frame and the “OK” button displayed.

In order to place the necessary interface elements to it, we need to redefine the “draw” function of our operator. Elements placement is built through the common object “layout”.

Let’s place on the window the label element with the output message text:

The second line with an empty label is needed only to make some gap between the message and the “OK” button.Define the “message” input parameter in our MessageBox operator to show its value in a pop-up window:

Define the “message” input parameter in the MessageBox operator to show its value in a pop-up window:

The complete code of the MessageBox operator:

This is the final code of the operator. When called, it will display a window with the text message sent.

In addition to text fields. any user interface elements – buttons, labels, checkboxes, input fields, etc. can be placed on such type of a window.


This MessageBox class is fully functional for use in any Blender add-ons. It can be saved in a separate file and if the developed add-on requires the message output, you can import it and use its functionality.


Author: Nikita

Blender add-ons developer and articles writer.