oo problem
Tool69
kibleur.christophe at gmail.com
Sun Dec 10 09:05:38 EST 2006
Thanks James,
It was a matter of choice : in my earlier version, all primitives know
how to draw themselves, but they needed to have a parent and I found it
was not good for aesthetic reasons.
but I think I've been misunderstood. Let's take a concrete sample :
I've got a Paper instance(-5,5,5,5) (the coordinates of lower-left and
upper-right rectangle: xlowleft, ylowlef, xupright, yupright) of my
paper.
I want now to draw an x-axis on it with some ticks and maybe lables, I
need to catch the xlowleft and xupright variables of the Paper inside
my primitive, ok ?
The problem lies inside my primitive, not on the draw method.
Here's a simplified example, I need to retrieve paper.xll and
paper.xur:
class Graduate_x( primitive ):
def __init__(self, orient = 'se', xorigin = 0, yorigin=0, xunit=
1.0, yunit=1.0):
primitive.__init__(self)
for k in range( int(math.floor(( paper.xll - xorigin)/xun)),
int(math.floor((paper.xur-xorigin)/yun)) ):
...something to construct my path
More information about the Python-list
mailing list