[PYTHONMAC-SIG] A bugfix for ped and a question (possibly long answer)

Just van Rossum just@knoware.nl
Fri, 16 May 1997 10:49:11 +0200


>class TAValue:
>
>        tr = 0, 0, 0, 0
>        testTE =  TE.TENew(tr, tr) #kills me stone dead
>        del tr
>
>        def TryNewTEChar(self, ch):
>                dhandle = self.TEGetText()
>                data = dhandle.data
>                TAValue.testTE.TESetText(data)
>                TAValue.testTE.TESetSelect(self.selStart, self.selEnd)
>                TAValue.testTE.TEKey(ord(ch))
>                dhandle = TAValue.testTE.TEGetText()
>                return dhandle.data
>
>        def __init__(self, x0, y0, x1, y1):
>        #lots more
>
>The idea was that testTE is a class attribute that gets set up as the file
>is read in.  Then I can use it in TryNewTEChar to do character by character
>filtering and updating as the user types.  I've been doing this in C (with
>a global variable rather than a class attribute) for years now, so I know
>it works.  Well, the line testTE = TENew(tr, tr) blasts my Mac into another
>world.  The cursor freezes, and bucky/escape won't kill the application.  I
>have to power down and back up.  Is this because TE is not Python but is
>glued in from the toolbox, or have I completely misunderstood about class
>methods and attributes?

TENew picks the current GrafPort to live in, which is probably the SIOUX
window in your case. I don't know why that still crashes as bad as it does,
but I've seen it happen indeed. How do you do this in C? (Kindof wondering
since I have not used TE much in C.) Do you set the GrafPort later
manually? If so, you can't do that in Python I think.

>Or should I be looking somewhere else?  I looked through the archive of
>this group last weekend, and saw one, maybe two references to this
>FrameWork.  I wonder whether that means that you guys use something else,
>like Tk or wxWindows.  I've even thought about hacking my C stuff into
>waste and adding glue for it.  But that means that I have to stop what I'm
>doing and go learn how to do that.

I use FrameWork a lot, but I have written a more abstract layer on top of
it. FrameWork is already a lot more abstract than the toolbox, but it's
still very cumbersome to make windows, controls, etc. I plan to release my
stuff, since I'm sure other people might find it useful, but it's not yet
generic enough.

>I can do my prototyping without input filtering if I remember to type
>carefully when I'm testing, but it would be nice to have it.  Any
>suggestions?

Isn't customizing the 'do_char' method of FrameWork.Window enough?

Just



_______________
PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
_______________