How to get the width of a string in pixels?

Posted by MA1 on Stack Overflow See other posts from Stack Overflow or by MA1
Published on 2010-03-16T14:40:40Z Indexed on 2010/03/22 5:51 UTC
Read the original article Hit count: 221

Filed under:
|

I am using wxPython's HyperTreeList and I want to set the column width exactly equal to length of the largest string in it.

To accomplish that, I'd like to to convert a python string size into pixels.

For Example: If we have a string like

str = "python"
len(str) = 6

How could I convert the above string length/size into pixels?

Is there another way?

© Stack Overflow or respective owner

Related posts about python

Related posts about wxpython