+ def SetFont(self, *args, **kwargs):
+ """ Set the font, then recalculate control size, if appropriate. """
+ wx.TextCtrl.SetFont(self, *args, **kwargs)
+ if self._autofit:
+## dbg('calculated size:', self._CalcSize())
+ self.SetClientSize(self._CalcSize())
+ width = self.GetSize().width
+ height = self.GetBestSize().height
+## dbg('setting client size to:', (width, height))
+ self.SetSize((width, height))
+ self.SetSizeHints((width, height))
+