Showing text in the area header in Blender

When executing modal operators such as rotation, translation, or scale, text with the current values ​​of the mesh parameters being changed is displayed in the header of the current area. If necessary, we can display any required text in the area header.

In order to display text in the area header, we need to call the “header_text_set” method of the required area, passing it a text string in the parameters.

If we just type in the Python console window:

The console header will be replaced with the “Sample Text” text.

If we need to display text in the header of a separate area, first we get a pointer to the desired area, for example, a 3D viewport:

and next we call the “header_text_set” method on it:

As a result, the “Hello World !” text will be displayed in the 3D viewport header.

To remove the text from the area header and return the menu back, we need to call the same “header_text_set” method with the None parameter:

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments