[wxPython] Character Sizes for wxDialog

Has anyone know how to get the width and height of a standard dialog based
font? So far I've gotten away with just manually setting the sizes, but for
layout calculations you need this info.

Under DC you use the method:

        xht, yht = DC.GetTextExtent("X")

How is this referenced when using a wxPanel or wxDialog, etc.

Lorne White

Has anyone know how to get the width and height of a standard dialog based
font? So far I've gotten away with just manually setting the sizes, but

for

layout calculations you need this info.

Under DC you use the method:

        xht, yht = DC.GetTextExtent("X")

How is this referenced when using a wxPanel or wxDialog, etc.

The wxWindow base class also has GetTextExtent.

But why not just use Dialog Units? wxDLG_PNT and wxDLG_SZE each take a
reference to the window and a set of "dialog unit" coordinants or sizes and
convert them to an actual wxPoint or wxSize based upon the average character
width and height of the default font. For example:

    self.text = wxTextCtrl(panel, -1, "",
                           wxDLG_PNT(panel, wxPoint(24, 4)),
                           wxDLG_SZE(panel, wxSize(36, -1)))

or

    self.text = wxTextCtrl(panel, -1, "",
                           wxDLG_PNT(panel, 24, 4),
                           wxDLG_SZE(panel, 36, -1))

···

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