[PYTHONMAC-SIG] ped/framework weirdness

James B. Wilkinson jimmy@CS.cofc.EDU
Tue, 13 May 1997 18:33:22 -0400

I was hoping to use the framework to do some experimenting with a project
I've been working on.  Finally got sick of trying to do it in C.  So I
started trying out the framework last week, and ped looked like a good
place to start since I want to use TE boxes.  The do_activate method in the
TEWindow class has a line       print "ACTIVATE", onoff        right at its
beginning.  I noticed that if I open two new windows in ped and click back
and forth between them, the print statement shows only *deactivate* events
in the Python output window: "ACTIVATE 0".  Furthermore, the behavior of
the grow boxes correlates with that.  Once they are gone they don't come
back unless I click in some other window, like the Python output window.
Then, when I click back in one of the editor windows, I get an activate
event in it and the grow box comes back.  Hmmm.

So I decided to put a print into the dispatch method in the framework and
see what's going on.  Well, that fixed the problem!!!  I started seeing
both deactivate and activate events (from the print line in do_activate).
So I started moving it around in the dispatch method.  Got the most
interesting results with it at the bottom:

      #print 'dispatch', name
      handler(event)    #this is the last true line of code in the method
      #print 'dispatch', name

Like this it acts as I described in the first paragraph.  If I remove the #
on the line before the handler call, everything works as I think it should.
If I put it back there and remove the # on the last line, then I get only
*activate* events when I click back and forth between two ped windows:

I'm totally confused.  If this were happening in C, I'd know what it meant,
but in an interpreted language?  Anybody got any ideas about what's going
on here?  Contributions gratefully accepted.

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