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.
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=""):
myLines=lines
def draw(self, context):
for n in myLines:
self.layout.label(text=n)
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")
ShowMessageBox(lines=myLines)
Reminder: you can use a custom title and icon each time you call this function:
ShowMessageBox(title="Uh-oh.", icon='ERROR', lines=myLines)