Script text dynamic

Hello, I have a problem with aligning a text with respect to its point of origin. When we add an F-Text and we choose center in the data of the object. in edit mode each time a letter is added the string remains centered with respect to its point of origin. I would like to get the same thing in script. I tried with the text.center, with the modulo, with the .format, nothing helps. So, if someone at the line must write to have the center of the text as in edit mode.

sorry for bad English, I use an automatic translator

Thank you