gtk.ScrolledWindow works with widgets in one of two ways:
1) For widgets with native scrolling support (for example gtk.TreeView,
gtk.TextView, Gtk.Layout) you simply add the widget to the
2) For widgets without native scrolling support (for example
gtk.DrawingArea, FigureCanvasGTK) you must first add the widget to a
GtkViewport, then add the GtkViewport to the scrolled window.
Attached is an example that shows this.
I already knew that ScrolledWindows worked this way but had never tried
putting a FigureCanvasGTK inside one, and was pleasantly surprised at
how nicely it works.
How is it useful to place the canvas in a scrolled window rather than
just displaying the whole canvas?
embedding_in_gtk3.py (1.07 KB)
On Sat, 2005-07-16 at 20:29 -0700, firstname.lastname@example.org wrote:
I have yet another question which I could not solve, even though I read
a lot of the backend specific source code today.
I use the OO interface of matplotlib, specifically the gtk backend, and
I would like to add scrollbars to the canvas widget. Normally I would
pack the widget into a gtk.ScrolledWindow and expect everything to work
fine. But the canvas widget ignores this and still scales with the
window size. Is it possible to specify a fixed size for the canvas?