Implementing my own ScrolledWindow



Hello,

I sent this to the pygtk mailing list, but didn't get an answer. I
thought that since the question equally applies to using GTK+ from C,
I could post it here.

I would like to implement my own ScrolledWindow that will hold a
TextView. The reason is that I would like to use the small square
between the horizontal scrollbar and the vertical scrollbar as a
resize grip. (The whole window will be a tooltip, so there would be no
other way to resize the window.)

I managed to pack the TextView and two scrollbars into a table, and
connect the scrollbars to the TextView. However, the TextView would
always expand to include the entire text in it, so the scrollbars
remain disabled.

How can I make it not expand?

Thanks!
Noam

PS. Here's my code:

import gtk
tv = gtk.TextView()
hs = gtk.HScrollbar()
vs = gtk.VScrollbar()
tab = gtk.Table(2,2)
tab.attach(tv,0,1, 0,1)
tab.attach(vs,1,2,0,1)
tab.attach(hs,0,1,1,2)
tv.set_scroll_adjustments(hs.props.adjustment, vs.props.adjustment)
w = gtk.Window()
w.add(tab)
w.show_all()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]