Hi everyone,

I'm trying to lead with adjustments. Supose that I have a HBox with a
Viewport and a VScrollbar inside it, sharing the same vertical
Adjustment:

##
self.hbox = gtk.HBox()
window.add(self.hbox)
self.hbox.show()

self.text_view_viewport = gtk.Viewport()
self.hbox.pack_start(self.text_view_viewport)
self.text_view_viewport.show()
self.text_view = gtk.TextView()
self.text_view_viewport.add(self.text_view)
self.text_view.show()

self.vscrollbar = gtk.VScrollbar(self.text_view_viewport.get_vadjustment())
self.hbox.pack_start(self.vscrollbar, False)
self.vscrollbar.show()
##

Like PyGTK tutorial says, shouldn't this just work automagically? But
it don't. When I insert new lines, the TextView grows vertically, just
ignoring the Viewport.
To make it work, I had to do the following:

##
self.hbox = gtk.HBox()
window.add(self.hbox)
self.hbox.show()

self.text_view_viewport = gtk.ScrolledWindow()
self.text_view_viewport.set_policy(gtk.POLICY_NEVER,
                                           gtk.POLICY_NEVER)
self.hbox.pack_start(self.text_view_viewport)
self.text_view_viewport.show()
self.text_view = gtk.TextView()
self.text_view_viewport.add(self.text_view)
self.text_view.show()
self.text_view.set_size_request(0, 0) # (*)

self.vscrollbar = gtk.VScrollbar(self.text_view_viewport.get_vadjustment())
self.hbox.pack_start(self.vscrollbar, False)
self.vscrollbar.show()
##

1) Shouldn't the Viewport work like the POLICY_NEVER ScrolledWindow?
2) Without the size_request, the TextView ignores the adjustment and
grows on the screen. Just setting this with the first Viewport widget
don't work.

Is this a bug or I missed something?
I'm using Python 2.4.2, PyGTK 2.8.2 and GTK 2.8.8 on a Gentoo Linux box.

Thank's for your patience :-).
--
João Paulo da Silva               -- JoãoPinga
Jabber: [EMAIL PROTECTED]
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to