[pygtk] Can't Get Text to Wrap With PyGTK TextView

Jusa sj.m at iloinen.net
Sat Jun 28 23:19:52 WST 2008


Hi, 

I've been trying to figure out why I can't get text to wrap by the word with
PyGTK TextView. I have a method similar to this in a class which is supposed
to create a scrollable TextView inside a ScrolledWindow:

def buildTextBox(self):
    self.scrollWnd = gtk.ScrolledWindow()
    self.scrollWnd.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
    self.scrollWnd.set_shadow_type(gtk.SHADOW_ETCHED_IN)
    self.scrollWnd.show()
    self.table.attach(self.scrollWnd, 0, 2, 1, 2)
        
    self.textView = gtk.TextView()
    self.textBuffer = self.textView.get_buffer()
    self.textView.set_wrap_mode(gtk.WRAP_WORD)
        
    self.scrollWnd.add(self.textView)
    self.textView.show()

With this code, when I type text into the resulting text box, the box seems
to expand out of the application window according to the typed text and not
wrap it as I intended. I also tried applying a TextTag with the wrap-mode
parameter to the TextBuffer but it didn't seem to have any effect.

I'm at a loss here, so I'd appreciate any help.
-- 
View this message in context: http://www.nabble.com/Can%27t-Get-Text-to-Wrap-With-PyGTK-TextView-tp18171787p18171787.html
Sent from the Gtk+ - Python mailing list archive at Nabble.com.



More information about the pygtk mailing list