On Tue, 2003-02-04 at 11:00, Gustavo J. A. M. Carneiro wrote:
> On Mon, 2003-02-03 at 23:35, Andreas Kostyrka wrote:
> > Hi!
> > 
> > I've been just wondering how one can display a scrolled image what is bigger 
> > than the screen?
> > 
> > DrawableArea in a Viewport in a ScrolledWindow works like a charm as long the 
> > image is smaller than the screen.
> > 
> > Any ideas? Is there some easier way then doing the scrolling myself 
> > (DrawableArea + 2 scrollbars)?
> 
>   I have never tried this in python, but in C I would create a
> DrawingArea and two scrollbars (not a DrawingArea inside a scrollend
> window!). The image would be a GdkPixbuf. The expose event handler would
> render part of the pixbuf to the DrawingArea's window. The part that
> should be rendered is determined from the scrollbar adjustments (x/y
> offsets) and DrawingArea window size (width/height). If this is not
> possible in python, it should--file a bug report.
>   Alternatively, you can use bonobo.ui to insert an EOG control widget
> to open the image you want ;)

  Here's the code for this last approach. It«'s fun! ;)

> 
> > 
> > 
> > TIA,
> > 
> > Andreas
> > _______________________________________________
> > pygtk mailing list   [EMAIL PROTECTED]
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Gustavo Joćo Alves Marques Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

#! /usr/bin/env python

import sys
if len(sys.argv) < 2:
    print "usage:", sys.argv[0], "filename"
    sys.exit(1)

import gtk, bonobo, bonobo.ui


win = bonobo.ui.Window("foo", "Image viewer")

obj = bonobo.get_object("file:" + sys.argv[1], "Bonobo/Control")
wid = bonobo.ui.widget_new_control_from_objref(obj, win.get_ui_container().corba_objref())
win.set_contents(wid)

win.show_all()
win.connect("destroy", lambda x: sys.exit(0))
bonobo.ui.main()

Reply via email to