Fonts problem, when switching from wxPython 2.8 to 2.9
I recently switched to wxPython 2.9 from 2.8. I ran one of my programs with 2.9. Everything seems to have worked, except the portion of my code that dynamically resizes fonts. The line where I change the font size seems to be the root of the problem.
Snippet:
sw, sh = self.get_geom(opt='wh')
font = wx.Font(sw/10 , wx.NORMAL, wx.NORMAL, wx.NORMAL) # This is the line that's giving me trouble
self.ST.SetFont(font) # self.ST is a static text widget.
The Error:
wx._core.PyAssertionError: C++ assertion "ff_family != (0<<4)" failed at ..\..\src\msw\font.cpp(672) in wxNativeFontInfo::SetFamily(): unknown wxFontFamily
This is in 开发者_运维技巧Windows 7 if it makes a difference.
family can be:
wx.DECORATIVE, wx.DEFAULT,wx.MODERN, wx.ROMAN, wx.SCRIPT or wx.SWISS.
thus you should use:
font = wx.Font(sw/10 , wx.DEFAULT, wx.NORMAL, wx.NORMAL)
精彩评论