Dynamic size based on font pixel width

Hi, I have some dynamic text with a background box that needs to widen to match the width of the text, this is how I am doing it at the moment, by multiplying by the average pixel width of arial. However it doesnt seem to be that accurate, any ideas?

_root.caption1.textbg._width = _root.caption1.words.length*7.5