How can I make a multi-line text box using the popup_menu function in my add-on?

The idea is that I could use it as a function that I could call anywhere and put any text in it.


1 Answer 1


I just found this way of doing it. Put this at the top of your add-on (you can also test it alone in the text editor):

import bpy

def ShowMessageBox(title = "Message Box", icon = 'INFO', lines=""):
    def draw(self, context):
        for n in myLines:
    bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)

You can then put the following anywhere in your code:

myLines=("line 1","line 2","line 3")

Reminder: you can use a custom title and icon each time you call this function:

ShowMessageBox(title="Uh-oh.", icon='ERROR', lines=myLines)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .