range and wx co - ords

Bengt Richter bokr at oz.net
Mon Nov 15 16:13:00 EST 2004


On 15 Nov 2004 08:43:01 -0800, mj.clift at virgin.net (Malcolm Clift) wrote:

>Hi Bengt,
>
>Sorry, I can see how vague my question is...
>
>I am showing multiple pages at once.I suppose that the simplist way to
>do it would be to have the position 'left' increase after so many
>lines or so many characters. The problem with that is that  although 
>I imagine  it  is very simple to do so I cannot work out how to say
>for every say something like for every 500 characters (or every 5 or
>so lines),  left = 100 +  say 1000.
>
This isn't homework, is it? ;-)

>As I said, at the moment I'm displaying multiple draggable pages (A4
>bmps) and I have just started to realise how slow that will be.
It is probable that you can improve the speed of dragging bitmaps if
you can do the relevant re-drawing a cached bitmap in a new position
instead of re-creating a bitmap in a new place -- if that's what's
slowing you down.

>Something akin to wading through mud :  ) So although it looks nice I
>think that I might have to go for a single page display. If that's the
>case could you give me some idea as to how I might define 'a new
>page', with the option of going forward and backward through the
>pages.You've done a lot for me already, so if that's more involved
>than I think I would be greatful if you told me where I might start
>looking for ways to do this.
>
I would suggest you take an OO aproach, and define a document class
that represents a sequence of pages, which in turn are defined by
a page class. Then you can flesh it out by defining methods for
setting dimensions and positions etc, and for initializing, updating,
and deleting display representations of the pages. Does your page text
come from files? Why don't you post what you have working so far?
I'm sure you will also get comments from people who are more familiar
with wx, which I haven't used. If you post something, I will learn something ;-)

If you don't know about classes and methods and objects and all that,
I suggest reading up on it and trying it out. It is a powerful way
of modeling your problem world, and decomposing it into chunks that
make sense.

Regards,
Bengt Richter



More information about the Python-list mailing list