On Thursday 17 January 2002 17:17, Michael Gilfix wrote:
>   Ok, more exploration: the real problem seems to be the scroll
> bar that's contained in the upper window. The scroll bar does not
> seem to resize to a size smaller than the original of the text
> box. I've changed the program Pedro posted so that it demonstrates
> the problem. One alternative is to enclose the scrollbar in a VBox
> and then the pane grip does not disappear when the pane is shrunk
> below the original size but the scroll bar doesn't change size either
> and just looks funny. Am I supposed to fix this via signaling?
>
>                    -- Mike
>

Mike, I think you are just killing the algorithms for layout management 
by mixing GtkTable and GtkHBox ;) Or maybe it will require refinement
on the layout constraints.

I propose a simpler approch with GtkScrolledWindow :

< t = gtk.GtkHBox ()
< table = gtk.GtkTable (2, 1)
< t.add (table)
< text = gtk.GtkText ()
< text.set_usize (-1, 150)
< table.attach (text, 0, 1, 0, 1)
< scroll = gtk.GtkVScrollbar (text.get_vadjustment ())
< table.attach (scroll, 1, 2, 0, 1, xoptions=gtk.FILL)
---
> import GTK
> t = gtk.GtkScrolledWindow()
> t.set_policy(GTK.POLICY_AUTOMATIC, GTK.POLICY_AUTOMATIC)
> text = gtk.GtkText()
> t.add_with_viewport(text)

If you need to access the scrollbar you'll need to add this :
> scroll = t.vscrollbar

BUT, I noticed that there is a bug in GtkScrolledWindow on
accessing vscrollbar attribute, import the following path
file :

----------------------------------------------------------------
patch.py
----------------------------------------------------------------
# BUG in 0.6.8 : GtkScrollWindow : has_attrs -> has_key
import gtk
from gtk import _obj2inst
import _gtk
def patch(self, attr):
    attrs = {
        'hscrollbar': _gtk.gtk_scrolled_window_get_hscrollbar,
        'vscrollbar': _gtk.gtk_scrolled_window_get_vscrollbar
    }
    if attrs.has_key(attr):
        return _obj2inst(attrs[attr](self._o))
    else:
        return GtkBin.__getattr__(self, attr)

gtk.GtkScrolledWindow.__getattr__ = patch
del patch
# end bug
----------------------------------------------------------------

Regards,
-- 
Pedro
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to