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

James B. Wilkinson jimmy@stono.cs.cofc.edu
Thu, 15 May 1997 19:24:46 -0400

In the method do_contentclick of class TEWindow the line

shifted = (modifiers & 0x200)

should be

shifted = (modifiers & 0x200) != 0

to get correct selection extension with the shift key.  I think that what
is going on is that the Mac toolbox (because of its Pascal origins?) wants
the value 1 for true, and no ordinary nonzero value (like the 512 you get
with the incorrect line) will do.  You were all waiting breathlessly for
this one to be fixed, right?

Now here's my question.  I put the following code into a class I made:

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.TESetSelect(self.selStart, self.selEnd)
		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?

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 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


Jimmy Wilkinson            | Perfessor of Computer Science
jimmy@cs.cofc.edu        | The College of Charleston
(803) 953-8160             | Charleston      SC        29424

If there is one word to describe me,
that word would have to be "profectionist".

PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

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