[wxPython-users] text size in statusbar

Andrea Gavana andrea.gavana at gmail.com
Thu Nov 2 12:47:07 PST 2006


Hi Oliver,

> but I find that the returned width is too small by about 20% for each field
> (which all have different length of text string): I have to multiply it by
> 1.25 to get it right. Clearly this is not the right way :)  Any suggestions?

Does something like:

dc = wx.ClientDC(statusBar)  # or wx.ClientDC(YourFrame)

# Try also:
# dc.SetFont(wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))

width, height = dc.GetTextExtent(fieldText)
return width

work? Or is the width still too small?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/




More information about the wxpython-users mailing list