[wxPython] Character size in pixels

Hi,

How can I get the size (in pixels) of the biggest glyph in the current font for
a given wxWindow object ? I'd like to be able to build a wxTextCtrl big enough
to enter, say 10 chars, and let it work on multiple plateforms.

Thanks for your help.

Alexandre Fayolle
http://fang.free.fr

How can I get the size (in pixels) of the biggest glyph in the current

font for

a given wxWindow object ? I'd like to be able to build a wxTextCtrl big

enough

to enter, say 10 chars, and let it work on multiple plateforms.

There's no way to get the size of the widest character without knowing what
that character is, but you can get some good approximations with the methods
that are available. Something like this might be good enough for you:

    w, h = window.GetTextExtent('W' * 10)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxpython.org Java give you jitters?
http://wxpros.com Relax with wxPython!

En réponse à Robin Dunn <robin@alldunn.com>:

There's no way to get the size of the widest character without knowing
what
that character is, but you can get some good approximations with the
methods
that are available. Something like this might be good enough for you:

    w, h = window.GetTextExtent('W' * 10)

This is exactly what I was looking for. Thank you very much. BtW, is there a FAQ
available somewhere (about wxPython and/or wxWindows)?

Alexandre Fayolle
http://alexandre.fayolle.free.fr