Please keep questions like this on the wxPython-users list. Thanks.
Chris Barker wrote:
Hi all,
I'm trying to use a StaticText that has a font twice the size of the
default font. I do this like so:Label2 = wxStaticText(self, -1, "Label 2", wxDefaultPosition,
wxDefaultSize)
Font = Label2.GetFont()
Font.SetPointSize(Font.GetPointSize() * 2)
Label2.SetFont(Font)Frankly that seems pretty clunky, but it should work, and it used to,
but when I upgraded to 2.4.0, I got a weird result. I got what looks
like Chinese characters to me, apparently a different font altogether.
If I only multiply the font size by 1.5, it works OK. I've enclosed a
screen shot of a test, where I create 3 StaticTexts, one normal, one
with the font 1.5 times normal, and one with it twice. You can see the
problem. In the code I printed out some font properties:
Please enter a bug report about this, but I suspect with what little I know about how gtk 1.x handles fonts that it may be tricky to fix. However, if you create a new font like this then it works:
of = Label3.GetFont()
Font = wxFont(int(of.GetPointSize() * 2), of.GetFamily(), wxNORMAL, wxNORMAL)
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!