arcpy.AddMessage Formatting

3226
3
05-10-2012 11:10 AM
MikeMacRae
Occasional Contributor III
Hi everyone,

Does anyone know of a way to format messages added to a python script via arcpy.AddMessage(). I want to be able to change the color of certain messages that gets printed in the GUI and it would hurt to know if you can use other formatting tools such as bolding, underlining, etc. I'm assuming you can do this because the traceback python scripts ESRI offers on their website will always print their messages in red.

Thanks,
Mike
Tags (2)
0 Kudos
3 Replies
JasonScheirer
Occasional Contributor III
The only formatting is a product of the type of message it is -- AddError and AddWarning give red and orange text in the window, but this is not in any way a formatting engine -- the colors vary to flag what TYPE of message they are.
0 Kudos
MikeMacRae
Occasional Contributor III
Ah, so I'm taking it you're saying this isn't possible? I was looking into other python modules like colorama, but it looks like that just changes python shell print line formatting instead of GUI messages. It would be nice if this was possible.
0 Kudos
JasonScheirer
Occasional Contributor III
No, it is significantly beyond the scope of GP message logging. The framework doesn't assume a terminal display as its target for messages, they can live in log files on a window or linux server, lines in a text file, elements in the results window in Desktop, etc. Formatted text is more the realm of an output parameter. Consider returning an HTML or RTF document report if that's your goal.
0 Kudos