Re: Determining the number of visible lines in a GtkTextView




    Well, besides determining the width of the
GtkTextView in
characters, I also need to determine its height in
lines, or the number
of visible lines. I've tried a solution with font
metrics, but the value

Here's an outline. It's pygtk, but I'm sure you can figure it out.
rect = textview.get_visible_rect()
low_iter = textview.get_line_at_y(rect.y)[0]
high_iter = textview.get_line_at_y(rect.y + rect.height)[0]
lines_visible = high_iter.get_line() - low_iter.get_line()

Stephen.
-- 
Stephen Kennedy <stevek gnome org>
http://meld.sf.net visual diff and merge




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]