In the attached code, a word-wrapping TextView is placed inside a
ScrolledWindow which has a vertical scrollbar policy of "automatic".
The problem is that if the width of the window is increased to a point
where the scrollbar disappears, it cannot be shrunk again.

The problem goes away if the vertical scrollbar policy is set to
"always" ... but is this how it's meant to work? Or am I not
configuring it right?

This is under PyGTK 2.17, Debian Squeeze.

Cheers,
Jason
import gtk
import pygtk

# SAMPLE TEXT
TEXT = (
"A gtk.TextView widget provides the display for the contents of a "
"gtk.TextBuffer object. A textview provides a set of attributes for the default"
" display of text from a textbuffer. The attributes set by gtk.TextTag objects "
"override the attributes set on a gtk.TextView widget. Since a gtk.TextBuffer "
"can be associated with multiple gtk.TextView widgets each having a different "
"set of default attributes, the display of the same text in different textview "
"widgets can be quite different except for those attributes that are overridden"
" by texttags.")

def destroy(widget, data=None):
    gtk.main_quit()

if __name__ == "__main__":    
    sw = gtk.ScrolledWindow()
    sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
    
    tb = gtk.TextBuffer()
    tb.set_text(TEXT)

    tv = gtk.TextView(tb)
    tv.set_property('wrap-mode', gtk.WRAP_WORD)
    
    sw.add(tv)
    window = gtk.Window()
    window.add(sw)

    window.connect('destroy', destroy)
    window.show_all()
    gtk.main()

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

Reply via email to