views:

150

answers:

2

I'm currently working on a simple wxPython app that's essentially document based. So far I've been manually implementing the usual open/save/undo/redo etc etc stuff.

It occurred to me that wxPython must have something to help me out and after a bit of searching revealed the docview package.

At this point though I'm just not quite sure how to hook everything up and get things started. Anyone got any good links or hints about places to start?

The docs seems to be a little thin about this and Robin Dunn's wxPython book doesn't really cover this package at all.

+1  A: 

You might take a look at the docviewdemo.py from the wxPython Docs and Demos:

on my machine they are located:

  • C:\Program Files\wxPython2.8 Docs and Demos\samples\pydocview\
  • C:\Program Files\wxPython2.8 Docs and Demos\samples\docview\
RSabet
+1  A: 

In addition to the ones mentioned, there is quite an extensive example docview/pydocview in the samples\ide. If you want it to run you will have to make a few code corrections (I have submitted a ticket that outlines the fixes at trac.wxwidgets.org #11237). It is pretty complex but I found it handy to figure out how to do some more complex things. For example, samples\ide\activegrid\tools\ProjectEditor.py is built from scratch and has undo support etc rather than just relying on a control that does everything for you already. That way you can see how things are supposed to be done at the detailed level. The documentation is rather useless in that regard.

If you have decided against using docview/pydocview I have a spreadsheet application built on wxPython that you may find useful as an example. While it does not implement a document view framework it does have some characteristics of it and I've implemented an undo/redo system. Check it out at http://www.missioncognition.net/pysheet/ I'm currently working on a pydocview based app so I expect that to be up on my site eventually.