I'm writing an e-book reader in Python + wxPython, and I'd like to find out how many lines of text can be displayed in a given RichTextCtrl with the current formatting without scrolling.
I thought of using and dividing the control's height by RichTextCtrl.GetFont().GetPixelSize()
, but it appears that the pixel size parameter of wx.Font
is only specified on Windows and GTK. In addition, this won't cover any additional vertical spacing between lines/paragraphs.
I could of course get the font size in points, attempt to get the display's resolution in ppi, and do it that way, but 1) the line spacing problem still remains and 2) this is far too low a level of abstraction for something like this.
Is there a sane way of doing this?
EDIT: The objective is, to divide the ebook up into pages, so the scrolling unit is a whole page, as opposed to a line.