From: Andre W. <And...@Ph...> - 2002-02-26 16:31:28
|
Hi, On 26.02.02, Joerg Lehmann wrote: > > (Next time it would be better to start a new thread for those things. > > Otherwise we'll end up in just one subject line with 100 postings ...= ) >=20 > I like long threads, which become more and more offtopic :)) At least, I do have changed the subject line and discuss only that part for the moment ... > > > How about > > > dropping the unit in canvas, i.e. the late evaluation of units? > > > I'm becoming more and more in favour of it, since I don't like: > > >=20 > > > - passing a canvas for the intersection of bezier curves > > > - passing a canvas for tranforming a arct into a bezier curves > >=20 > > The same for the h-size problem in tex.py. >=20 > I know. So we have three, and maybe even more in the future... For sure. > > One problem on dropping that out of the canvas is, that we then do no= t > > know anymore how to change the unit, which we use, if we just write > > plain numbers. If I see through it correctly, that was the reason for > > the marriage of the canvas and the units and therefore for the late > > evaluation. What about just saying t.text(1,2,"bla"). In what units > > are these 1 and 2 are measured? (Same for paths, like lineto and > > thatever else ...) >=20 > Yes, that's true. But maybe we can use a hack, which stores the base=20 > unit globally (as a static property of the unit class). Isn't > something like that possible in Python 2.2? I don't think its related to Python 2.2. Such a construction is available all the time --- or maybe I have misunderstood you. Do you mean something like this: class unit: defaultunit =3D "1 u cm" ... You should be able to access that all the time and this value is global (I might be wrong here but I do remember something like this). However, if we do such a construction, we could also put that defaultunit outside of the unit class. It is global for the unit module (and in die end global for pyx). It might be natural (I feel quite sure), that we then do have a global unit variable. For the moment, we don't have it and therefore run into the troubles you talked about. We may know just decide, what to do. I would say, that it is ok. Even so, there is a way out by doing: import pyx as pyx1 import pyx as pyx2 Whenever you use now pyx1, you should be able to access the pyx1 global defaultunit, whereas you do the same within pyx2. I haven't tried it (have never done something like that), but hopefully this is possible. The key for doing so, is that the lineto for example doesn't just look for pyx.unit.defaultunit, but for self.???.unit.defaultunit. The question is, if all that is available in the modules namespace somehow. But I guess so. We should try it. It would be a nice starting point for writing a arg.tex like proposal on units ... Andr=E9 --=20 by _ _ _ And...@Ph... / \ \ / ) http://www.physik.uni-augsburg.de/~wobsta/ / _ \ \/\/ / watch a movie and learn about the mystery tippe top: (_/ \_)_/\_/ http://www.physik.uni-augsburg.de/~wobsta/tippetop/ |