[wxPython-users] Re: calc nr of visible characters in wx.TextCtrl
Dmitriy Baranov
dmitriy at summatech.ru
Mon Aug 14 03:00:50 PDT 2006
stefaan пишет:
def calcNrOfVisibleCharacters(self):
# get widget's size
cs = float(self.textcontrol1.GetClientSize()[0])
# ^^
# get size of characters and inter character spacing
te = float(self.textcontrol1.GetFullTextExtent('X')) #
returns (width,height,descent,leading)
# ^^
return max(cs/(te[0]+te[3])-3.0, 3.0) # minus 3 is found by
trial and error
More information about the wxpython-users
mailing list