oo problem

Tool69 kibleur.christophe at gmail.com
Tue Dec 12 15:09:09 EST 2006


Dennis Lee Bieber a écrit :

>
> 	Perhaps you missed that the loop (in Paper) that invokes each
> primitive's draw() is passing itself (the Paper instance)...
>

Oops, sorry I missed it in fact.

But I still have a problem with my the primitives (some pathes I had to
build ):
i.e a mathematical ray is infinite, so I must draw a segment on screen
and need the paper sizes to calculate the segments starts and ends (
I've got a lot of objects like this ). I don't know how to build them
without passing a paper instance.
The actual implementation of some primitives uses :

def __init__(self, paper_instance, etc. ):
    do something

But I as mentioned before, I'm not satisfied with it since I shall
write this do draw a Line :*
paper.draw( Line( paper, x1, y1, x2, y2) This is what I don't find
aesthetic : the repetition of "paper" calls.




More information about the Python-list mailing list