[pygtk] TextView/ScrolledWindow questions

skip at pobox.com skip at pobox.com
Thu Aug 10 21:00:19 WST 2006


I have a TextView widget inside a ScrolledWindow which is itself inside a
Dialog (all assembled in Glade) that I use as a general-purpose help viewer
for my application.  When someone pokes a help button, I slap in the
appropriate help text and show the dialog.

Questions:

1. Since the TextView widget starts out empty, apparently the ScrolledWindow
   thinks it never needs to display the scrollbars.  It's like it makes that
   decision at the start then never reconsiders it.  I have the horizontal
   and vertical policies set to Automatic.  Is there something I can do to
   tickle it into reconsidering its policy when I change the text contents?

2. Ideally, I'd like to use a horizontal policy of Never and have the
   TextView widget resize horizontally to accommodate the longest line of
   text I insert.  Is that possible?  I tried creating a Pango font
   description for the font I am using, computing the longest line length in
   points (and assuming 1 pixel is approximately 1 point wide) set the size
   request of the TextView.  Nada.

I saw nothing in the FAQ about either question.  Any suggestions?

Thanks,

-- 
Skip Montanaro - skip at pobox.com - http://www.mojam.com/
"On the academic side, effort is too often expended on finding precise
answers to the wrong questions." Baxter & Rennie, in "Financial Calculus"


More information about the pygtk mailing list