WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

textview - all text viewable?

View: New views
2 Messages — Rating Filter:   Alert me  

textview - all text viewable?

by txtoth :: Rate this Message:

| View Threaded | Show Only this Message

For a textview in a scrolledwindow is there a way to know that all of
the text can be seen without scrolling? Can one know if the vertical
scrollbar   is displayed? I want to only enable a button when all of
the text has been reviewed by scrolling to the bottom but if there
isn't enough text to require scrolling I want to simply enable the
button.
_______________________________________________
pygtk mailing list   pygtk@...
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: textview - all text viewable?

by towb :: Rate this Message:

| View Threaded | Show Only this Message

On 26.05.2012, at 18:08, Ted Toth wrote:

> For a textview in a scrolledwindow is there a way to know that all of the text can be seen without scrolling?

s = buffer.get_start_iter()
e = buffer.get_end_iter()
r = view.get_visible_rect()
y, _ = view.get_line_yrange(s)
start_in_sight = y < r.y
y, _ = view.get_line_yrange(e)
end_in_sight = y < (r.y + r.height)

(untested)

_______________________________________________
pygtk mailing list   pygtk@...
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/