tags:

views:

70

answers:

1

I'm trying to write a simple "hello-world"-type program using the python-evince package for lucid-lynx gnome, that embeds Evince in a python-gtk window. The samples I've found on the web go like this:

import evince
import gtk

w = gtk.Window()
w.show()
e = evince.View()
w.add(e)
e.show()
document = evince.document_factory_get_document('my pdf file')
e.set_document(document)
gtk.main()

The problem is that "evince.set_document" no longer exists: The forums seem to indicate that there have been recent changes, but I have been unable to figure out the (probably very simple) modifications necessary to get this working. Can anyone help?

A: 

The API has changed, with an extra step added. These instructions should help:

>>> e = evince.View()
>>> docmodel = evince.DocumentModel()
>>> doc = evince.document_factory_get_document('file:///path/to/file/example.pdf')
>>> docmodel.set_document(doc)
>>> e.set_model(model)
Tim McNamara
@SLR set_document is called from DocumentModel@Tim I think that you have an extra evince.. shouldn't it be evince.DocumentModel() ?
Cez
thanks @Cez, corrected
Tim McNamara
Thanks to both of you! I get no error messages now. Sadly, I just get a blank screen and no visible pdf document.... Does anyone know how I can get information and/or documentation for the new API??
SJR